Search the Community
Showing results for tags 'walking'.
-
Alright, been stuck on this for a few days and starting to think I'm overlooking a very simple solution. I have a character that I want to walk back and forth on the screen. He needs to walk to one edge, turn around, then walk to the other edge, again turn, walk, etc.; rinse and repeat. I've tried simply '+=' and '-=' on his x coord with an if statement but he wont seem to walk in the other direction. Example, writing 'steve.x += 1;' then 'steve.x -= 1;' won't work. He gets to one edge but then stops. I've also tried using tweens but he seems to become jittery as he's a spritesheet already, maybe? His physics body will stay, but the pixels themselves seem to move outOfBounds. Anyway, here's the full code for what I'm working on, any help is greatly appreciated. http://pastebin.com/V0GM7z3w Also still learning Phaser so any feedback on code flow is helpful too! Thanks!
-
So I have 3 different characters (using the same sprite at the moment). They are supposed to roam given a predefined path for each. I am using 3 different loops so that they start at different times. I don't want them to start and stop at the same time. Trying to make it as natural as possible and so far I got this http://jsfiddle.net/Batzi/abs191e5/250/ Can someone suggest improvements? I need to make it look as smooth and natural as possible.
-
Hello, I am new to Phaser and I am still learning how to move sprites on the screen among other things. I have this walking animation set: http://i.stack.imgur.com/pGGbv.png I'd like to move my character anywhere on the screen by using the arrow keys (up,down,left and right). Now I know how to execute something when an arrow key is down but my question is related to the PNG file that I am loading. 1) Do I load it as a spritesheet? 2) Do I use the "animations.add"? 3) How do I separate the frames in the PNG to correspond to specific arrow keys? ex: If I press down, I want to use the first row of that PNG and make use of every frame to animate the character's movement. I also need to move that character on the screen with every frame used so I assume character.body.velocity.x/y should be used in this case.