• 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!

GameMaker Declaring Variables

Simple answer: yes.

Code:
with(instance_create(x,y,object))
{
  variable1=5;
  variable2=10;
}
But things get a bit tricky if you want to do something IN your create event with those numbers you are setting. The full create event goes off before you get a chance to set any variables.
 
use a with block on instance_create and declare the variables inside it.
If the create event needs the variables, use a user-event instead and call that from the with block after setting the variables.
 
Top