need a little help on my pacman clone in C++

so me and a couple of friends are doing a c++ project. so far we are moving forward, but i got stuck on the ghost, its eating our pellets! can anyone here give some ideas?

note:were not using graphics lib for simplicity

the code is posted on the other forum:(im tryin to get as much help as i can)
http://www.daniweb.com/software-development/cpp/threads/367878
Last edited on by twicker
closed account (S6k9GNh0)
Even if you aren't using a graphics lib, using something like nCurses would be worlds amount of less pain for you.

EDIT: And why is this in the "Articles" section?
Last edited on
note:were not using graphics lib for simplicity


Ironically I was going to suggest using a graphics lib to make it simpler.
HINT 1

The Player struct should really be named Position or something like this.

HINT 2

A solution to the flickering problem would be to redraw only the parts of the map that
actually need redrawing, e.g. the previous and current positions of the game entities.

You can use a Position array and an integer to hold this information:

1
2
Position need_redraw_pos[10];
int need_redraw_count; 

Then, when you want to redraw these parts, you can simply move the
console cursor on the right position and print the appropriate character.

HINT 3

You can use this to change the console cursor position:

1
2
3
4
5
6
7
8
9
void gotoxy(int x, int y)
{
    COORD pos;

    pos.X = x;
    pos.Y = y;

    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

Though, you'll probably have to use it like this -> gotoxy(y,x),
as your_map_x == console_y and your_map_y == console_x.

HINT 4

If you want more hints, edit your post and move it to the beginners section.
I have been doing something similar recently using the console, i don't know why it would eat them because you have instructed the pacman and only the pacman to eat the pellets, so for the ghost to eat them shows that there is a flaw in your design.
Topic archived. No new replies allowed.