Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Board for PacMan  (Read 2982 times)

0 Members and 1 Guest are viewing this topic.

vamsi360

  • Newbie
  • *
  • Posts: 3
    • View Profile
Board for PacMan
« on: December 24, 2011, 08:23:23 am »
Hi,

Sorry if this is redundant.

I am creating a pacman game as a basis for AI algorithms implementation as part of our course work in the college.

I want to know how to create a maze in SFML. Currently I have the pacman character moving in the window.

Reference to the tutorials would also be helpful. Thank You.
Future belongs to the king and AI is the king.

Turbine

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Board for PacMan
« Reply #1 on: December 24, 2011, 09:42:44 am »
A grid holding solid values would suffice (for both solids and drawing walls), then something like A* path finding could be used.

http://code.google.com/p/a-star-algorithm-implementation/

vamsi360

  • Newbie
  • *
  • Posts: 3
    • View Profile
Board for PacMan
« Reply #2 on: December 24, 2011, 12:26:52 pm »
How to create the grid? Can you explain?
Future belongs to the king and AI is the king.

ScoreX

  • Newbie
  • *
  • Posts: 6
    • View Profile
Board for PacMan
« Reply #3 on: December 25, 2011, 12:23:51 am »
The easiest way would be to have two arrays ( rows and columns ) and fill them with 1's and 0's which will define the maze.

Then you just draw the maze. Every square there is a 1, you have a wall. Every square that is a 0, you have a walkable path.

A small example:

1111111111111
1000000000001
1111110111111
1000000000001
1111111111111

You can walk about in either stretch where there is 0's, and you can pass from one side to the other using the middle path with the 0.

 

anything