Page 1 of 1

Sonic style deaths

PostPosted: Sun Jan 08, 2012 6:17 pm
by CrimsonTheDarkBat
Ok, in the words of Steve Jobs: one more thing...

I basically want the player in my game to have the same "death system" used in the Sonic the Hedgehog games. For example, the player collects rings scattered throughout the level and I want it so that when the player hits the enemy while not attacking, the ring count is reset to zero. But - the big thing is this: I want the players death event to only take place if the player hits an enemy while the ring count is at zero. How do I do this?

Thanks and whatnot!

Re: Sonic style deaths

PostPosted: Sun Jan 08, 2012 6:34 pm
by phyzix5761
on the collision event (or whatever event the hit happens on)

do something like this:

Code: Select all
if(rings>0)
{
  rings = 0;
}

if(rings==0)
{
  //do death sequence
}

Re: Sonic style deaths

PostPosted: Sun Jan 08, 2012 7:11 pm
by savvy
as he said but with expansions.

Code: Select all
int i;
if(rings>0)
{
  for(i=0;i<rings;i++)
  {
createfloatingring;
}
  rings = 0;
}

if(rings==0)
{
  //do death sequence
}


Then inside the floating rings, on create put.

Code: Select all
directional_velocity=rand(maxspeed)+minspeed;
angle=rand(360);


change min and max speeds to the speeds.

helpful?

savvy

Re: Sonic style deaths

PostPosted: Mon Jan 09, 2012 4:10 pm
by SuperSonic
I would like to add something. Instead of using "if(rings == 0)", just use "else" :wink:

Re: Sonic style deaths

PostPosted: Mon Jan 09, 2012 4:23 pm
by foleyjo
CrimsonTheDarkBat wrote:Ok, in the words of Steve Jobs: one more thing...


I think you mean columbo :lol: