Help with logic in game..

I have a map Texture loaded and drawed, what is the best way to place the pacman sprite animation inside it (which I know how..), and to make it move only in the appropriate path on the map? (I mean how to restrict it to the path only, how logically I need to approach this?)

I'm using SFML

thanks!
Last edited on
someone suggested me, "you can have invisible sprites that acts as unpassable barriers", maybe ill try this, but if you guys have any other suggestions, I be glad to hear...
Create a bitmap.
Each row of the bitmap is one logical row of the map.

1
2
3
4
5
6
7
8
0000000000000000000000000000000
0111100000000000000000000000000
0100000000000000000000000000000
0100000000000000000000000000000
0111111100000000000000000000000
0000000100000000000000000000000
0111111100000000000000000000000
0000000000000000000000000000000

If there is a '1', your guy can move into that logical cell on the game map.

A quick sample of some actual pacman images (count the horizontal and vertical rows of dots) suggest you can declare
1
2
3
unsigned int map[32] = {
  0x.....
};


Or even as strings, it would be small enough.


another suggestion to use rails with nodes that the sprite is following..
Topic archived. No new replies allowed.