Gamerev147
Member
So basically I coded a super simple spawner for medkits in my game. I would like to keep it simple.
However my problem is that when they spawn, some spawn in open areas (they should do this) and some spawn in the walls and other solid static objects (should NOT do this).
My code is below, just tell me how to fix this with a short explanation. Thanks!
obj_Medkit_Spawner :
Create Event:
Alarm 0 Event:
But the medkits spawn in the walls. I've also tried the place_free function but to no avail.
However my problem is that when they spawn, some spawn in open areas (they should do this) and some spawn in the walls and other solid static objects (should NOT do this).
My code is below, just tell me how to fix this with a short explanation. Thanks!
obj_Medkit_Spawner :
Create Event:
Code:
randomize();
alarm[0] = 60;
Code:
///Spawn Medkit
if (!place_meeting(x, y, obj_Parent)) { //i have all solid walls attached to a parent so i can call them all once, it works
instance_create(random(room_width), random(room_height), obj_Medkit);
}
alarm[0] = 60;