This site requires JavaScript, please enable it in your browser!
Greenfoot back
Mellowas
Mellowas wrote ...

2018/2/26

Pacman moves by coordinates

Mellowas Mellowas

2018/2/26

#
Hello guys, I have to make a pacman game - very simple version. How it's possible to move pacman only by coordinates, because I don't want to draw the map, I just downloaded full map from google and set as a background and want that Pacman will go only by coordinates.
Super_Hippo Super_Hippo

2018/2/26

#
Save an array representing the map in your world. (For example 1=wall, 0=no wall.) Then Pac-Man can check if he is moving correctly.
xbLank xbLank

2018/2/26

#
Super_Hippo wrote...
Save an array representing the map in your world. (For example 1=wall, 0=no wall.) Then Pac-Man can check if he is moving correctly.
I would highly recommend not doing that. I have seen people do that a lot of times and this is a very poor way of handling your game.
Super_Hippo Super_Hippo

2018/2/26

#
Why is it a poor way? Checking the number in an array based on your location is faster than checking for intersection with a wall object in the world.
danpost danpost

2018/2/26

#
Super_Hippo wrote...
Why is it a poor way? Checking the number in an array based on your location is faster than checking for intersection with a wall object in the world.
Even better might be to add invisible intersection actors at any place pacman can turn. They could even hold which directions are available to go from their individual locations. In other words, instead of detecting walls, detect the intersections, which gives where a turn can be made (by its location) and which ways are available to go from there (by fields).
You need to login to post a reply.