Hello all, its been a while
I'm currently working on this point and click game where the user click on a map and the character will follow the [target placed on the ground] So far I have managed to create a character that limit itself to the boundaries of the map and that follows the target icon whenever the map its clicked.
My game it is not tile based but it does have a tile based node system. What I want to be able to do is to hard code the nodes in each map, while then create the program that will validate these nodes by adding them. That way I can control and or erase nodes that are non walkable for my character.
I have tried pathfinding algorithms but they seem to advanced for me. I seem to understand the words but the practice is a failure. Can anyone guide me in my initial stages.
Right now I have my nodes hard placed on the map they are called "node_mc" all of them. I think the first thing I need to do is to re-name them all like "node_mc1", "node_mc2", "node_mc3" etc... etc... etc... to differentiate them or can I leave them like that? Please look at the picture attached.
¡Hola! ¿Como estan los coquis?
Well I haven'd coded AS in like 4 years, and AS2 in like 6. Sorry If I don't whip up a script off the top of my head.
I would suggest the following logic.
1) Store your bodes in a 2 dimensional array. eg.:grid [x][y]
2) you could then have a player grid position(PGP), where the player is at , and Target grid position (TGP), where the player wants to go.
3) in the grid there will ALWAYS be 8 adjacent blocks to the PGP. You could then recursively loop trough these checking the nodes.
-if it's a 'blocked' or 'impassable' node skip to next node.
- if the block y value is the closest of all 8 to the TGP then remember that blocks 'Y'
- if the block X value is the closest of all 8 to the TGP then remember that blocks 'X'
- Move the player to the node stored in grid[x][y]/etc.
- IF the X/Y of the player DO NOT mach the X/Y of the target repeat/ else wait for new target
Since you have only stored (mapped) the position of the nodes in a grid virtually' in the array.. you should be able to retain the rest of your coding strategy.
Hopefully that helps
Jeje! los coquies estan bien
Thanks you for the example. Now here is where my biggest problem lies. I don't seem to see the big picture after reading. So, I will start with numero 1.
1) Store nodes in a 2D Array called: Grid[x][y]
- Since I will be hard coding/placing the nodes to the stage I will tell each node to push it's own coordinate on event(load) to the main Grid[x][y] on the root. And that will create my Main Grid System.
NOTE: My character already follows it's own target. On click the stage, the character will center itself to the disk_locator. Now How do the point system works with this method?
This topic is now closed. New replies are no longer allowed.