Moving in grids using tilemap

Hi there!

I’m really new to Phaser and I can’t for the world figure out how to move in grids. I’m trying to create some sort of Snake clone. I have a tilemap made in Tiled with 10 rows and 20 columns. Each grid is 20x20 pixels big. My first layer is the background.

tilemap

I also have an empty “playLayer” in the same size with two tileset images, the snake and the apple.

applesnake

If I’m using arcade physics and, for example use , setVelocityX(100), the “snake” moves 1 pixel at a time in a steady pace. What I want is for it to move 20 pixels at a time inside the tilemap.

If this doesn’t make sense I can clarify later, am in a bit of a hurry.

Thanks in advance! Richard

This demo may be what you’re looking for.

1 Like