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

[GM] Enemy type problem


Slow_Motion

Recommended Posts

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 point

CaP is the Chaos point

if I spawn the points in the room without it coming from an enemy it follows shadow just fine

ShadowDi.png

Im trying to imitate what the white chaos energy or whatever does in this engine.http://www.youtube.com/watch?v=SZeZyv2WECA

Btw do you like my hud?

Edit: oops forgot to say I'm working with Gamemaker8 Pro

Link to comment
Share on other sites

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]

  • Like 1
Link to comment
Share on other sites

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 :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

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