1 decade ago by Alistair
Hey everyone,
I am recreating pacman for a university project, i am using Hurik's A* pathfinding plugin and i am having trouble implementing a few things. Any help you can give me to get me along the right lines would be great. The plugin is working fantastic, however I want to implement the following features...
1. How could I edit the script so it only looks for paths in the direction that pacman is moving ( no backwards movement)
2. If I wanted to set the target position to be 4 tiles in front of pacman, so if pacman is moving right then the target tile will be 4 tiles to the right of him. The problem here is of course if i set the target position 4 tiles to the right and the 2nd tile is a collision layer then the target position will be out of bounds.
I am recreating pacman for a university project, i am using Hurik's A* pathfinding plugin and i am having trouble implementing a few things. Any help you can give me to get me along the right lines would be great. The plugin is working fantastic, however I want to implement the following features...
1. How could I edit the script so it only looks for paths in the direction that pacman is moving ( no backwards movement)
2. If I wanted to set the target position to be 4 tiles in front of pacman, so if pacman is moving right then the target tile will be 4 tiles to the right of him. The problem here is of course if i set the target position 4 tiles to the right and the 2nd tile is a collision layer then the target position will be out of bounds.
if(this.path == null){ var pacman = ig.game.getEntitiesByType( EntityPacman )[0]; this.getPath(pacman.pos.x, pacman.pos.y, false); this.followPath(this.speed); }