GameMaker [SOLVED] Spawning enemies inside of a object

Z

Zeathus

Guest
Hey, I'm trying to spawn enemies inside of a object, so technically I have a rectangle 160 x 768 and I'm having trouble spawning enemies onto that rectangle or better said inside of the rectangle
 

woods

Member
a simple way to do this would be do specify the x, y, w and h values of obj_spawnarea, and reference these from your obj_bomb creation code:
xmin = obj_spawnarea.x;
xmax = xmin + obj_spawnarea.w;
ymin = obj_spawnarea.y;
ymax = ymin + obj_spawnarea.h;

instance_create(random_range(xmin, xmax), random_range(ymin, ymax), obj_bomb);
 
Z

Zeathus

Guest
I can't test it out it's searching for a variable w and h cause this is gamemaker studio 2 do you know maybe what's the gamemaker studio 2 name I'm trying to find it right now but I'm not getting any luck
 
Top