kstamatov85

Members
  • Content Count

    17
  • Joined

  • Last visited

About kstamatov85

  • Rank
    Member
  • Birthday 01/26/1985

Contact Methods

  • Website URL
    http://compresscss.com/

Profile Information

  • Gender
    Male
  • Location
    Bulgaria

Recent Profile Visitors

812 profile views
  1. @deedeekaka My workaround to set cursor on text is to attach a transparent tileSprite on it. You can take the dimension of the text object and create tileSprite with the same size. Then You add the tilesprite to the text as its Child. Now you can inputEnable the tileSprite and apply cursor on it. var backText = _t.make.text(-(popup_width / 2), (popup_height) - 90, SP.lang.backLabel, SP.font.blueSmallFont); backText.anchor.setTo(0.5, 0); var backTextclickArea = _t.make.tileSprite(0, 18, 190, 45, 'transparentPixel'); // The size cords could be generated dynamically !!! backTextclickArea.anchor.setTo(0.5, 0); backTextclickArea.inputEnabled = true; backTextclickArea.input.useHandCursor = true; backTextclickArea.events.onInputDown.add(_t.goBack, _t); backTextclickArea.input.priorityID = 10; backText.addChild(backTextclickArea);
  2. I found the answer, unfortunately it was straight forward. var bullet = this._bulletGroup.getFirstDead();this.time.events.add(1100, this.splashBullet, this, bullet);splashBullet: function( {console.log( // bullet object}Shame on me but anyway, hope this will help someone
  3. Hi guys, I'm trying to pass a agrument to a callback function from a time event. Unfortunately I cant figure it out how. var bullet = this._bulletGroup.getFirstDead();this.time.events.add(1100, this.splashBullet, this);How to pass the 'bullet ' object to splashBullet function? it is not part of 'this' scope.
  4. Hi, I was on a same issue and it took me time to find how to use minParticleSpeed and maxParticleSpeed. The documentation say: minParticleSpeed : Phaser.Point The minimum possible velocity of a particle.Which is not very helpful at all, because there is no clue how to use it or set it and what kind of parameters it needs. There is nothing in the examples as well. Anyway I found this tutorial which open my eyes for those. //make the player explodevar emitter = this.game.add.emitter(this.player.x, this.player.y, 100);emitter.makeParticles('playerParticle');emitter.minParticleSpeed.setTo(-200, -200);emitter.maxParticleSpeed.setTo(200, 200);emitter.gravity = 0;emitter.start(true, 1000, null, 100);this.player.kill();
  5. It is what I mostly need to know. How costly the tweens are and according to the 'performance price' where and with what purpose we should use them? Another one is if I run one time tween should I remove it from the global scope? Example case: scorePoint : function() { var pointText = this.add.text(200, 200, "\n +1 \n"); var pointTextTween = this.game.add.tween(pointText) .to({y: 100}, 800, Phaser.Easing.Linear.None) .to({alpha: 0, y: 50}, 400, Phaser.Easing.Linear.None) .start(); pointTextTween.onComplete.add(function() { pointText.destroy(); this.game.tweens.remove(pointTextTween); // IS THIS CORRECT ??? }, this); },
  6. Like full cycle of the tween is 800ms. Can i control that in update?
  7. Thanks, but in update function I cant control the timing accurately
  8. Hi guys, in my game I have an arrow, which should rotate all the time from 50deg to -50deg starting from 0 deg. It should do that with the given timing. My code looks like: // POINTER TWEEN GH.g_pointerTween = _this.game.add.tween(GH.g_pointer) .to({angle: -_this.pointer_rotation_angle}, 400, Phaser.Easing.Linear.None) .to({angle: 0}, 400, Phaser.Easing.Linear.None) .to({angle: _this.pointer_rotation_angle}, 400, Phaser.Easing.Linear.None) .to({angle: 0}, 400, Phaser.Easing.Linear.None) .loop().start();The question is if that is the correct approach for using the tween for that kind of purpose? I noticed that the tween lags a bit and wondering is it more efficient way to achieve it? And one more, when user hit the target I would like to show animated notification: scorePoint : function() { var pointText = this.add.text(200, 200, "\n +1 \n"); var pointTextTween = this.game.add.tween(pointText) .to({y: 100}, 800, Phaser.Easing.Linear.None) .to({alpha: 0, y: 50}, 400, Phaser.Easing.Linear.None) .start(); pointTextTween.onComplete.add(function() { pointText.destroy(); this.game.tweens.remove(pointTextTween); }, this); },Since I'm creating a local scope variables for the text and tween all for single use, is this the correct approach for solving that issue? Can I reuse the tween without initialized it every time when I call the function and remove it after it finish? Thank you in advanced and sorry for the noobie questions!
  9. Tom, how to apply those in my code? Could you use the example above and show us. Thanks
  10. I try that, because it was most obvious, but phaser returns "TypeError: a.setStageReference is not a function". Anyway I found a workaround, but it is not as elegant as I would like to be. var textObj = {};for(x in GH.userProfileData){ textObj.x = this.add.text(200, pos, GH.lang.userProfileLabel[x]+': ', GH.font.labelFont); textObj.x.anchor.setTo(1, 0); };I guess there should be a phaser way to do that more clean
  11. Hi guys, I have a problem with setting the anchor position of text object that have no refference for. var profileData = this.add.group();for(x in GH.userProfileData){ profileData.add(this.game.make.text(0, pos, GH.lang.userProfileLabel[x]+': ', GH.font.labelFont)); profileData.add(this.game.make.text(200, pos, GH.userProfileData[x].toString(), GH.font.valueFont)); pos+=50; }I try chaining .anchor(1,0) to first text, but it did not work and unfortunately couldn't found anything about that issue. Anybody know how to solve that issue?
  12. I was going threw the phaser examples and I saw game.add.tween(text).to( { alpha: 1 }, 2000, "Linear", true); When try to use it Phaser gives me an error for "Linear" string. Since small investigation I found this in the docs. It contains all the easings, so the correct code was game.add.tween(text).to( { alpha: 1 }, 2000, Phaser.Easing.Linear.None, true); Hope this is helpfull
  13. Hi all, I have issue with reversing the tween animation for the angle of sprite. My element is set with angle of 270 deg and want to rotate it to 180. And I did, but the animation is moving from right to left and it do the full circle before reach 180. How may I reverse the animation? Thanks
  14. Face the same issue and thought to solve the problem by same putting transparent sprite above the tileSprite. I worried if it is ok, but since it work for you, this is the workaround (: Cheers UPDATE: firstly I thought to use transparent png image to click on, but since some research I decide to use transparent bitmap and add it as sprite. Think this is better approach. var bmd = this.make.bitmapData(1080, 1920); //creates the BitmapData object var tabZone = this.add.sprite(0, 0, bmd);tabZone.inputEnabled = true;// add event listener to click/taptabZone.events.onInputDown.add(this.shootBullet, this);