Pacman 'eating' problem
Hi there,
Im a fairly new programmer, literally picked up Java 12weeks ago on my course, and now Ive been told to make a game resembling pacman- where the character eats the enemies.
The game basically involves a pacman-like character (a filled arc) and puts him in a space invaders like situation- with falling/advancing enemies- and I want the pacman to eat the enemies.
Sounds simple enough but I just cant get my head around it. The enemies have a coordinates for their upper left x/y position and have a height/width in relation to the sprite they are displaying (e.g. 10x10pixels). The pacman also has an X/Y position, is set to a size of 38 and is user controlled by the keyboard.
Ive tried code such as
if ((monsterXPos == munchieXPos) && (monsterYPos == munchieYPos))
and then make the enemy disappear off screen. I thought this would detect the collision between the two and then allow the pacman to 'eat' the enemy, but it seems to be a random occurence and if the pacmans x or y position matches the enemies then it will eat it, and not only in a situation where the 2 characters meet- they could be on opposite sides of the screen and if the coordinates match then it will 'eat' the enemy.
Does anybody have any ideas on how to solve it? Should I post my source? Its really bugging me now!

