Legacy GM There MUST be an easier way! (Pathfinding)

hughrock18

Member
Hey everyone! The beginning of this thread is exposition of things leading to the problem. Don't have time for that? Skip down to the "comment", // HELP HERE //.

In making an isometric "continuation" of yugioh the duelist of the roses called "Yu-Gi-Oh! The Shadow of the Dark Roses".

For those of you who have played duelist of the roses, you know what I'm talking about, but for those who haven't but still want to help; You play with a little over 300 (i think) different cards on a 7x7 board. Each card (regardless of whether it was a monster spell or trap) could move exactly 1 space across the board each turn. Each space was a terrain that would give certain monsters both a power boost and a movement bonus OR give a different type of monster a power reduction. The exception was the normal terrain that gave no bonuses or reductions at all. The movement bonus would allow the card to move 1 additional space while that card remained both in that terrain and face up.

To that effect, i have it set up so that the game recognizes when a card is on a "bonus" terrain tile and even generates all the appropriate code and visual effects to allow the player to move the cards around the board.

I have a control_board obj that constantly updates a dsgrid with the grid position (not the actual xy coor in the room but the xy coor in the grid) of all cards in play. That same controller also updates every cards pos_gridx and pos_gridy variables in accordance to that cards position in the dsgrid. It's a simple 2d for loop that checks each cell in the grid for a value other than -1. If that cell doesn't equal -1 then it equals the instance id of a card object. An easy with function does the rest.

Now I'm at the point where i need to allow the player to move cards around. However, i cant figure out an effective way to do this.

// HELP HERE //
Here's where i need help! I have it setup so when the player taps (its an android game) on a tile containing a card the game creates a new controller (control_moveCard) that then creates 4 objects (12 objects when a movement bonus is active) that mark the range of movement for that card. I need to be able to tap on any of those tiles and make the selected card to move along the tiles (including moving around an impassable tiles). Not only that but i need to allow the player to change their mind if need be. I even set some global variables to store the original placement of the selected card when control_moveCard is created. The selected card can't "lock" to the new tile until the player presses a separate confirmation button. With that i mind the player meds to be able to sselecta tile and then select another tile and watch the card follow the isometric path to the newly selected tile.

I can go in and make a unique path script for each of the possible 12 selectable tiles but i figured pretty quick that that was ludicrous! Especially when selecting a tile after the card moved to another previously selected tile.

I'm sorry for the lengthy message. I might have given more details than needed but i wav hinted to make it as clear as possible the first time. So... Thanks for the perseverance. Any info would be appreciated.
 

Relic

Member
I’m only half understanding your requirements. Are you aware that paths can be created at runtime? You might like to consider using the mp_grid functions (see manual for more details)- but in a nutshell you set up a grid as well as which locations in the grid can be passed through and which cannot- then ask to have a path from position A to position B and the functions will return a suitable path.
 

hughrock18

Member
I mever knew that a function like that existed!

And here i thought i had read through the manual. I guess i missed this or forgot.

Either way, it looks very promising.

Quick question. Skimming over the manual at that function... I can createt a path along the grid, but it DOES allow me to set diag movement as the ONLY movement allowed along the grid, right?
 
Top