A Star Pathfinding - modifying - PLEASE HELP

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I need to use Sketchy's brilliant pathfinding algorithm in my game because I'm nowhere near that clever but I am struggling to adapt it to fit my purpose.

    The only thing I need to do is to be able to start the map at a grid number larger than zero. You see, when I move my map to the bottom of the screen (where the character will need to walk) the whole thing breaks because it's probably mapping the top nodes starting from zero. I have studied the code over and over and tried lots of things but I can't seem to add 26 to the Y value anywhere in order to get it to work again.

    Please find attached my attempted modification. I have added an alterable string to the pathfinder which says "AGE Y start" and added the value 26 to it because ideally I would like to be able to change this at the start of a new environment to tell the code how far down the screen it should start the mapping process.

    I'm still a bit of a noob so sorry for maybe missing something which might seem obvious but I can't for the life of me find where I need to add this value in the event editor. My guess is that the loops are starting at zero (which would normally make sense) but I really need them to start at the new alterable string value which will change depending on the graphics of my game's level.

    Download my rubbish reverse engineering attempt at:
    Please login to see this link.

    I assume that by placing obstacle objects over the unwalkable areas that this should work pretty well once I attach my animated character to the node. Also.. is there any way to speed the movement up at all?

  • UPDATE: I'm such a retard! I just realised I've been thinking about this all wrong. I can't change the value of my nodes because if I do that then my nodes are always going to be out of range. Instead I need to add some maths that trick the equations into starting the counting of the nodes 832 pixels down the screen (because that's where my walkable area starts).

    I notice there are a lot of times the code gets the x and y positions of an object and then divides those by tile width and tile height in order to identify a node area. If I add an upper bound value to some of those (ie: 832 in this case) before dividing... in theory it might then being to work again.

    I might be better off mapping the whole screen and just putting some simple code in to restrict the uses of nodes 0-25 in the Y dimension instead. Then again, it seems pointless putting nodes on an open list that are out of bounds for the game character to walk in the first place. I guess I could pre-list them all as closed nodes perhaps but again it seems like a silly workaround since there must be some values I can set somewhere to specify where the map should start.

    I'll have another fiddle with it tomorrow using this new thought process but if anyone can give me any hints or take a look I'd really appreciate it! - Cheers.

  • UPDATE: I finally figured this out so I thought I'd share...

    The program doesn't have an open list, it only has a closed list so just set your map width and height to the number of nodes that fill your playfield, it will work just fine wherever your start node is and wherever your obstacles are.

    In order to stop my character walking above the horizon, I just added a condition when the user clicks to make sure the node value is greater than the upper bound node which I stored as a new alterable value in the pathfinder object. That stops the start icon moving too far up the screen.

    To change the speed of the thing, this part was a little tricky. Simply create a new value called multiplier or whatever in the start icon and add a new line of code in the (move horizontally and move vertically section BUT PLACE IT AT THE TOP). You want to store MOVEX *2, *4 (however many pixels you want) in this value. Then instead of dividing the absolute value of MOVEX or MOVEY from MOVEX or MOVEY, Divide it from the new multiplier number instead.

    My character is now running all over the screen beautifully and picking the correct paths avoiding obstacles.

    I want to thank Sketchy for this little program... it's amazing!! Now my point and click adventure game will have a bit of AI when my character is walking around my various rooms! :)

  • Hi
    Thanks for share your file. But it seems not cross platform . I test it on SWF exporter and unfortunately it doesn't work and it's strange because there is not any extension. Is any suggestion ?

    My website and 2d Animation artworks: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!