• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Changing Step Event through Creation Code?

D

DIYDamian

Guest
Is there any way to set what's in the step event by using creation code? I'm making little turrets for a bullet hell game, and want variety with the patterns. I just need to change how the code is in the step event to make this work. The other way I found of doing this was by creating an entirely new object for each pattern, but I'd much rather not do that.
 

DesArts

Member
You can set a variable 'pattern' which can be 0-however many patterns you want
Code:
pattern = 0;
You can set this when the object is created to whatever pattern is needed.

And in step:
Code:
switch (pattern)
{
    case 0:
        //do pattern 0 stuff
    break;
    case 1:
        //do pattern 1 stuff
    break;
    case 2:
        //do pattern 2 stuff
    break;
}
 
D

DIYDamian

Guest
You can set a variable 'pattern' which can be 0-however many patterns you want
Code:
pattern = 0;
You can set this when the object is created to whatever pattern is needed.

And in step:
Code:
switch (pattern)
{
    case 0:
        //do pattern 0 stuff
    break;
    case 1:
        //do pattern 1 stuff
    break;
    case 2:
        //do pattern 2 stuff
    break;
}
that seems to work. thanks for the help
 
You can use object parenting and just override the step event for the child objects.

Alternatively you can use script_execute(pattern_script) in the step event, with pattern_script being set to the preferred script id when the instance is created. This would remove the need for hard coding a case statement and all the associated code in one big step event.
 
Top