Zonar Games Posted July 6, 2006 Report Share Posted July 6, 2006 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 More sharing options...
Kain Posted July 6, 2006 Report Share Posted July 6, 2006 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 && animation != "hurt") { if( global.Rings > 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. 1 Link to comment Share on other sites More sharing options...
Zonar Games Posted July 6, 2006 Author Report Share Posted July 6, 2006 thanks I'm going to test it along with the layering right now! Link to comment Share on other sites More sharing options...
Recommended Posts