trueicecold

Members
  • Content Count

    53
  • Joined

  • Last visited

About trueicecold

  • Rank
    Advanced Member

Recent Profile Visitors

604 profile views
  1. In the following example found Here, The text will not update inside the bitmap, unless I recreate this.totalScoreText using game.make text again... Is this a bug? if I use setText regularly, and use game.add.existing(this.totalScoreText), it works ok... SOLVED: Thanks to rich, it was made clear that game.make doesn't add to the update loop, so setText won't work, unless I add the immediate flag: text.setText("Sometext", true);
  2. variables that belong to a state should be used with the "this" keyword, making it relevant to that instance alone. As for players, I would suggest using an array of players: players[0] and players[1] instead of this["players" + n]. Or better yet, save the position of the current player (if it's turn based): this.currentPlayerIndex = 2; this.players[this.currentPlayerIndex].start(); //or whatever...
  3. Hey all, I'm creating a 4 player card game, and I find myself handling positions for every player position for each element (cards, player name, score, shoutout text etc...), since player on the left and right have rotation to the cards, different tweens etc... This results in quite a big JSON to define all positions to all elements, and is making the code quite dirty... How do you handle large UI positioning? Thanks!
  4. Thanks for the example! for some reason, I haven't been able to reproduce it today anymore :/
  5. Hey all, I have a yellow text which I tint to 0x444444 at some cases (disabled mode), and I want to return it to yellow. I've tried tinting to 0xffffff but I get darker yellowish with strange text borders... if (sum <= 7) { this.button.tint = 0xffffff; return true; } else { this.button.tint = 0x444444; return false; } Any ideas? Thanks
  6. Actually, traditional MMO games don't execute commands on the sender side before it reaches the server. For all concerns, the sender is also a receiver, and should act like one. The bullet shouldn't be fired on the sender side, without receving a command to fire it from the server, just like other players should.
  7. Hello, I'm trying to destroy a group after an animation ends, but I'm getting script errors... Code: this.enemy_sprite = this.group.create(x, y, 'zombie');this.enemy_sprite.scale.set(1);this.enemy_sprite.scale.x = -1;this.enemy_sprite.smoothed = false;this.enemy_sprite.anchor.set(0.5, 0.5);this.walk_anim = this.enemy_sprite.animations.add('walk');this.walk_anim.play(10, true);this.group.destroy(true);works ok, but: this.enemy_sprite = this.group.create(x, y, 'zombie');this.enemy_sprite.scale.set(1);this.enemy_sprite.scale.x = -1;this.enemy_sprite.smoothed = false;this.enemy_sprite.anchor.set(0.5, 0.5);this.walk_anim = this.enemy_sprite.animations.add('walk');this.walk_anim.onComplete.add(this.destroy, this);this.walk_anim.play(10, false);this.destroy = function() { this.group.destroy(true);}causes a JS error: Uncaught TypeError: Cannot read property 'getFrame' of null phaser.js:53464 Phaser.Animation.update phaser.js:53464 Phaser.AnimationManager.update phaser.js:52802 Phaser.Sprite.preUpdate phaser.js:37442 Phaser.Group.preUpdate phaser.js:21860 Phaser.Group.preUpdate phaser.js:21860 Phaser.Stage.preUpdate phaser.js:20367 Phaser.Game.updateLogic phaser.js:26737 Phaser.Game.update phaser.js:26684 Phaser.RequestAnimationFrame.updateRAF phaser.js:46614 Phaser.RequestAnimationFrame.start._onLoop phaser.js:46598 I'm using the latest Phaser 2.2.2 from github (pulled yesterday)
  8. To remove a specific animation: sprite.animations.getAnimation("run").destroy();To remove all animations from a sprite: sprite.animations.destroy()
  9. Thanks rich, but I can still start with 2.2, right? no breaking changes in 2.3?
  10. I'm at a puzzle now whether I should start working on the dev branch of phaser 3 or start with the good old phaser 2 engine... Right now I know Phaser 2 is much more mature and much more documented and supported. On the one hand, we always strive for the best performance and structure. On the second hand, this could take months until we have a stable version, plus I don't use anything outstandingly heavy in the game I'm planning to create (But heavily built on states). Am I right to assume it's better to still keep writing games in the old Phaser 2 engine?
  11. For a simple game, with very few moving elements (very simple animations with very few elements using GSAP), Is there a real reason to use canvas or webgl programming rather than DOM? For me at least, writing simple html and javascript is much faster than writing a PIXI/Phaser code, and I really can't see the reason of using canvas for the type of game I need, especially if working with crosswalk or WKWebView, where the browser is fast enough to render more than simple animations... Your thoughts?
  12. I second horkida, using physics means Phaser calculated weight, torque, gravity etc., while tween simply transitions a property. Even if the outcome is the same, physics will use lots more calculations.
  13. I'm not familiar with p2, but physics speaking, wouldn't giving the ball constant force/torque achieve this? Why do you need to play with gravity for this?
  14. try saving "game" as a global variable so you can access it upon creation. Alternatively, replace "this.game" with "Phaser.GAMES[0]"
  15. valueerror, yes, but that means I'll have to use it inside the "render" event to take care of resize events. I was wondering if there's a way to "bind" it so that I don't have to re-align elements when resizing.