Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need help making grid based movement for my project.
- Yoakenoshika_
-
15 posts
Need help making grid based movement for my project.
i'm working on a modified version of griffpatches tile based scrolling engine and I want the character to only move on a grid, i'd appreciate some help.
Im hoping they can move like the pokemon in pokemon mystery dungeon so it's not choppy and still looks good.
https://scratch.mit.edu/projects/1140479274/
If anyone can give me ideas on how to change the movement code of the player/camera I'd really appreciate it!!
Im hoping they can move like the pokemon in pokemon mystery dungeon so it's not choppy and still looks good.
https://scratch.mit.edu/projects/1140479274/
If anyone can give me ideas on how to change the movement code of the player/camera I'd really appreciate it!!
- TheCoder12365
-
100+ posts
Need help making grid based movement for my project.
As far as I know there is only two ways to do this. The first one (easy one) is to move the player the length of a grid square, but in steps so you can move them smoothly. Otherwise, the only other way I know to accomplish this is to have a script that looks at a list of all grid squares, then it does a check to see which one the player is in (item # of “x” and “y”). Then depending on which direction your moving it changes the players x/y by a full grid square in that direction and then records that. Using that, we can then find which square the player would be going to. Lastly you can achieve smooth movement to the new grid square by using the desired position and the old player position. I'll put a script for the last part under this.
Hope this helps!
Hope this helps!
Last edited by TheCoder12365 (Feb. 28, 2025 13:39:45)
- Yoakenoshika_
-
15 posts
Need help making grid based movement for my project.
Hi, the player isnt on the tile grid like the tiles are, so I don't know how I'd do this?
- Arcplayz_
-
88 posts
Need help making grid based movement for my project.
do this, this is how I did it:
basically you move, but you're shown as locked onto the grid.
basically you move, but you're shown as locked onto the grid.
- TheCoder12365
-
100+ posts
Need help making grid based movement for my project.
You could start the player on a grid square. Hi, the player isnt on the tile grid like the tiles are, so I don't know how I'd do this?
- Discussion Forums
- » Help with Scripts
-
» Need help making grid based movement for my project.