Walking single blocks

Would there be a way(And I know there is one, just I don’t have the code) to have a game set up so that when I press one of my arrow keys, I walk a full block, and only one full block? I have my movement system set up like the retro pokemon games. I also have walking animations for my sprite, but I want them to stop once I’ve traveled the block, and go to the standing position in the direction that I pressed. If there is a template for this, I would love that. thank you.

No replies yet?

what is the game site

The blocks are 32 pixels on a side, so if you just shift the position by 32 pixels in one direction an object will move one block.

This works, but it isn’t smooth, and I want to have a walking animation over to the next block, and then I want it to stay on the last frame of the animation until I press an arrow key again.

http://flowlab.io/game/view/661617
Also, I had a character sprite, but it didn’t save. I have to re-upload it, but that’s fine, since I have a zip-file with all the sprites in it.

Maybe a timer that is set to like, 1 10th

repeat 32 times

I’ll try that…

Here’s a possible approach - it’s kind of weird since it has a cursor, but may give you some inspiration. It basically just uses an Ease node to smooth out the movement - that would probably simpler than a repeating timer: http://flowlab.io/game/play/554372

I tried to copy the code without ctrl+c, but once my player warps to the cursor, the cursor seems to disappear, and the arrow keys don’t do anything.
https://flowlab.io/game/view/661617
I actually was looking for a way to make a cursor, thanks!

The cursor goes to the top-left edge of the screen; coordinates (0,0).
[Edit:] I added a ‘Once’ to the extractor that sets 0, but after that, the arrow keys don’t work.

You have some problems you need to address:

  1. No keys selected in the key triggers (Change them to arrows or wasd or something)
  2. Move message isn’t getting sent to anything (Send it to your player)
  3. Player and cursor are colliding (set your player to no solid & no collisions)

Then it will behave like the example I posted, if that’s what you’re after

Oh, derp. I don’t have arrow keys wired. :L