View Single Post
  #1 (permalink)  
Old 01-07-2008, 02:54 PM
jaferris jaferris is offline
Member
 
Join Date: Jan 2008
Posts: 1
jaferris is on a distinguished road
Two Problems Rotating and collision detection help
hey i am creating a similar pacman game and i can move the monster UP, Down, Left and Right

What i am trying to do is when moving down how do i make it soo the mouth will face down too same as going left and up.

Other problem is how do i make the object i hit dissapear the collision detection

Sorry if posting in wrong area but any code will be helpfull

here is a sample of the direction code

switch (monsterDirection)
{
case Input.DOWN:
// monster is moving right, increase its X-coordinate
monsterYPos = monsterYPos + monsterSpeed;
if (monsterYPos > (boardWidth - monsterSize)) // has the monster hit the right wall?
{
monsterYPos = boardWidth - monsterSize; // move it back to just touching right wall
monsterBumpWallSound.play(); // play an appropriate sound
}
break;

// to do - fill in appropriate code for other directions
}
// increment the monster animation counter
monsterAnimationCount++;
if (monsterAnimationCount >= 10) // when the counter gets to 10, set it back to 0
monsterAnimationCount = 0;

// update each munchie animation
for (int i = 0; i < NUM_MUNCHIES; i++)
{
// increment the animation counter
munchieAnimationCount[i]++;
if (munchieAnimationCount[i] >= 10) // when the counter gets to 10, set it back to 0
munchieAnimationCount[i] = 0;
}

edit

it now rotates the way i am facing via this code

switch (monsterDirection)
{
case Input.LEFT: case Input.NONE:
// this is the angle of the roof of his mouth
// when his mouth is fully open
startAngle = 205;
break;
// to do: fill in animation code for other directions
}

i just need to know how something dissappears when you touch it

Last edited by jaferris : 01-07-2008 at 03:19 PM.
Reply With Quote
Sponsored Links