Good day, I’m new to GDevelop and I’m making a top-down RPG. I would like to know how can I make an object, particularly an NPC, move on a certain path like in Pokemon Red and Blue without stopping or moving in diagonals?
There are many ways.
The way I would personally use is a pathfinding behavior with a custom one that makes the pathfinding go to a point defined in a list of points stored as an object structure variable and when arriving to one going to the next one and when arriving to the last going pack to the first etc.
This might be too difficult for a beginner like you though.
I think the easiest way would be for you to use something like the top down movement, and simple conditions. Example
When on position x1 y1 simulate going down for top down movement behavior.
When on position x1 y2 (aka when previous movement finished) simulate going right.
You could use a similar system with forces. The disadvantage is that you can’t make it go 2 times through the same spot and in different directions.
If you need it to go 2 times through the same spot you would need to use additionally a variable to keep track of the last movement to know what should be the next one. Variables may be a complicated concept for a beginner tho, but you’ll need to learn them sooner or later anyways as they are the only way to store data in short term.
Thanks for the feedback @arthuro555. I do tried using forces but unfortunately it’s all messed up. I’ll try to apply what you said and see if I can manage to do it.
I tried doing as you said but I seem to face a problem. The top-down behavior for the object that I want to have the movement doesn’t show up on simulate key.
For example, I did:
The X position of object=192
The Y position of object=352
And when I tried adding the action “Simulate down key press” it shows “The behavior is not attached to this object. Please select another object or add this behavior.”