Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Ring loss problem in Damizeans engine?


Recommended Posts

Ok I have been having trouble with ring loss in damizean's engine. I have tried many different methods of getting this right and it done the same thing. Sonic dies when he is hit with rings. Here is some sample codes I tried for making this right?

 // Lose rings
if ( action == action_hurt && animation != "hurt")
{
rings_create_ringloss (min(global.Rings,32), x, y ) global.Rings -=global.Rings;
sound_play(snd_ringloss)
}

// If no rings then kill Shadow
if ( global.Rings <=0 )
[/CODE]

[CODE] // Lose rings
if ( action == action_hurt && animation != "hurt")
{
rings_create_ringloss (min(global.Rings,32), x, y )
sound_play(snd_ringloss)
global.Rings = 0;
}

// If no rings then kill Shadow
if ( global.Rings <=0 )
[/CODE]

There are some other methods I tryed but I can't remember them. But they were probally similar to the ones above. Does anyone know how when Sonic gets hit by a badnik for example and he has rings the rings are decreased to 0 and he is still alive and when he is hit with no rings he dies?

Link to comment
Share on other sites

Yay, logic error! OK, before you check if you have any rings, first you run the ring loss code and set your rings to 0. See a problem with that?

Anyway, you're code should look something like this:

if ( action == action_hurt &amp;&amp; animation != "hurt")
{
     if( global.Rings &gt; 0)
     {
          //Ring loss
          rings_create_ringloss (min(global.Rings,32), x, y ) 
          sound_play(snd_ringloss)
          global.Rings = 0;
     }
     else
     {
         //Kill Shadow or Sonic
      }
}

See? When Sonic gets hit one of two things can happen: he loses his rings or he dies. Using if...else makes sure they don't both happen.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...