Slow_Motion Posted February 10, 2010 Report Share Posted February 10, 2010 Im not sure if this would qualify as an enemy problem but... yea. My problem is that When my player destroys an enemy nothing comes out no stamina points or chaos points. here is my code I used for it. In step I put wex=floor( random( 3.0 ) )if hp<=0 && wex=0{instance_destroy()exit;}if hp<=0 && wex=1{instance_create(x,y,StamP)instance_destroy()}if hp<=0 && wex=2{instance_create(x,y,CaP)instance_destroy()}if hp<=0 && wex=3{instance_create(x,y,CaP)instance_create(x,y,StamP)instance_destroy()}[/CODE]StamP is the Stamina pointCaP is the Chaos pointif I spawn the points in the room without it coming from an enemy it follows shadow just fineIm trying to imitate what the white chaos energy or whatever does in this engine.http://www.youtube.com/watch?v=SZeZyv2WECABtw do you like my hud?Edit: oops forgot to say I'm working with Gamemaker8 Pro Link to comment Share on other sites More sharing options...
Vexus Posted February 11, 2010 Report Share Posted February 11, 2010 One note about using floor(random(x)). The chances of getting x with this function (3 in your case) are stupidly high. Thankfully, GM8's new irandom(x) function give x an even chance too. This cleaned up version of the code should take care of all the problems. If not, there might be some other code interfering with process... if hp <= 0 {--wex = irandom(3);--switch( wex ) {----case 1: instance_create(x, y, StamP); break;----case 2: instance_create(x, y, CaP); break;----case 3: instance_create(x, y, StamP); instance_create(x, y, CaP); break;--}--instance_destroy();}[/CODE] 1 Link to comment Share on other sites More sharing options...
Slow_Motion Posted February 11, 2010 Author Report Share Posted February 11, 2010 One note about using floor(random(x)). The chances of getting x with this function (3 in your case) are stupidly high. Thankfully, GM8's new irandom(x) function give x an even chance too.This cleaned up version of the code should take care of all the problems. If not, there might be some other code interfering with process... if hp <= 0 {--wex = irandom(3);--switch( wex ) {----case 1: instance_create(x, y, StamP); break;----case 2: instance_create(x, y, CaP); break;----case 3: instance_create(x, y, StamP); instance_create(x, y, CaP); break;--}--instance_destroy();}[/CODE]Thanks it works perfect Link to comment Share on other sites More sharing options...
Recommended Posts