• Content Count

  • Joined

  • Last visited

About head

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. head

    Uncaught ReferenceError: game is not defined

    place "var game" outside the init function, remove "var" from init function.
  2. head

    Very New To Phaser

    so you just need to use the nextWord() in your key press callback and get rid of the game.time.events stuff what exactly did you try, what is not working?
  3. head

    drawRoundedRect width immutable

    you don't change graphics properties on the fly you redraw it graphics.clear() .beginFill(...) .drawRect(...) .endFill()
  4. head

    I can't find the bugs in my code

    Try disabling parts of code (gui/player/tilemap) one by one and see what happens.
  5. is this what you are looking for? https://phaser.io/examples/v2/sprites/pivot
  6. head

    low FPS when all my sprites are killed

    can you show the code?
  7. head

    tracking the enemy

    The enemy behaves exactly as you told it to =) In this code: if (!checkOverlap(player, enemy)) { if (enemy.body.x < player.body.x - 10) { enemy.body.velocity.x = 30; //enemy.body.velocity.y = 0; } ... }Th The thing is that the tree is just big enough. So when enemy is trying to converge with the player +/- 10 pixels is just not enough to come around the tree. Hint: you won't solve this using some constant numbers. You either need additional rules (like gravity and jumping) or you need some kind of pathfinding.
  8. head

    Sprites pushing each other and jumping

    I'm beginning to think I'm gonna have to switch to square bodies and then check for 'touches' property, if unit is touching something then stop its velocity in that direction. The 'touches' property doesn't seem to be working with round bodies, which is understandable. However I thought using round bodies would give a more natural unit positioning. Any thoughts, anyone?
  9. head

    kill a tween only if the tween exist ???

    If I get it right, there are several ways come to mind: 1. check if it is defined if (typeof this.tween_repulse_to_right != 'undefined') { 2. check if it's a tween (requires it to be defined with any value) if (typeof this.tween_repulse_to_right == Phaser.Tween) { 3. the simpliest way if (this.tween_repulse_to_right) {
  10. Hey guys, hope you're having a great time. And I have a little problem you may be able to help me with. I'm making sort of RTS and there are lots of units marching to each other and killing each other. The problem is, they are stepping onto each other, and kind of pushing each other, and sometimes even jumping someplaces. This looks weird. Watch this video and you will understand what I'm talking about (I'm using Warcraft 2 sprites just for testing purposes, and also because they are great). https://www.youtube.com/watch?v=6htpVG8Shyc A little more details: I'm using Arcade physics. All units are objects of the same class, derived from Phaser.Sprite. All of them have a circle body, anchor set to 0.5 (if if matters), and are moving using velocity (before that I was modifying their poistions manually but with the same result). Units belong to 2 different groups, each group is collided with self and other group - so they won't walk through each other. What I want is that units would be standing still and no one could move them, not to mention these weird jumps. Is there some common techinque for handling this, do I miss something? Thank you in advance.