I am trying to create a turn-based, click-to-move rpg, and been stack for awhile on the actual functionality. I will appreciate any help you can give me. Mind you, I consider myself to be a very slightly above full GDevelop 5 beginner, so a bit more explanation might be needed
Please consider the following screenshot:
- The game has near 400 way markers spread across a map.
- The player is allowed a certain range “per game turn”.
- Player can only move to “reachable” locations (green animation) on click.
- Once player reaches any of the markers within his range, the rest of his “game turn” is forefiet. So in essence, even though the player can have more than one markers within his range, he can only “land” on one per turn.
- Once player lands in a way marker, a pop-up … “pops up”.
I have already figured out how to change the “reachable”/“unreachable” change of animation, by measuring the distance between the player object and the way marker (as you can see from the screenshot). I even figured out a way (and i am proud of myself for that, even though to you, professionals it might look as a child’s play ) to limit the movement of the player object to only available way markers by measuring the distance between the cursor at place of click and the player.
Where I am stuck, however is how to move the player to the clicked location and how to detect the clicked location without pathfinding. First I thought that I will write instance variables to all way markers, but the custom settlement markers will be unique (city and town names, etc…).
Then I thought applying pathfinding and hidden obstacles, but I don’t know how to limit the movement “per game day”, i.e. have something like 300 pixels “per day” so once the player icon has “travelled” 300px, it stops, no matter how many times you click, until you “End the turn”. And then i got lost … so I thought I will ask the nice smarter than me people of the GDevelop forums for help.
Finally, if this helps, what im trying to achieve can be seen in this half pseudo / half js code
FOR EACH way marker CLICKED
marker has “reachable” animation
player is within the allowed distance
move player to the clicked location
remove the rest (if any left) of the allowed “game turn” distance
WHEN player “lands” on a way marker
CHECK the object instance variable name
IF object instance variable name is normal way marker
something, something …
ELSE IF not normal way marker
something, something …