• 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 [Solved] Create Instance depending on variables

Y

Ychabod

Guest
Hi,

I don't know if the title is clear.. (probably because I'm a noob. And French.)
I will try to explain !

I've 8 objects in my project for the 8 characters of the game.
Is it possible to create a instance of object_"X" where this "X" is a variable ?

For example, like this :
Code:
if(var X = 1)
instance_create_depth(x,y,z, object_"X")
The player can choose the character to control, and my code is very long, because i've a lot of if statement like if x = 1 spawn obj_1, x = 2 spawn obj_2 etc..

PS : I'm on TRIAL version of GMS2, so I don't have scripts ^^'
 
Top