E
EvilShuckle
Guest
Hey guys, im having... a think a tricky problem. The floor the player can stand on is made up by several invisible squares. Each of these square pieces checks whether the player is within range (and some other criteria) and if all criteria are met, it will spawn a tomb on top of the square which the player has to destroy quickly.
The idea itself works. If the player is within range, there is no other tomb being spawned that very moment and there are no more than 4 tombs, then a tomb is spawned. Problem is: at the very beginning of the game, only one of the squares checks it. On a square in range, a tomb is spawned. Which then stops spawning tombs because there already is one on top of it. But if the player walks out of its range, then no tombs are spawned anywhere.
What I want is: Each ground piece checks seperately and constantly whether the player is in range and if so, and the other criteria are met, it spawns a tomb
this is the code (a create event that sets an alarm, and underneath is the alarm)
It is a messy way of programming, I know. I am new and I sort of solved it through creativity, not so much skilled programming
tl/dr: During the entire game currently only one tomb spawns. It should be spawning constantly everywhere
The idea itself works. If the player is within range, there is no other tomb being spawned that very moment and there are no more than 4 tombs, then a tomb is spawned. Problem is: at the very beginning of the game, only one of the squares checks it. On a square in range, a tomb is spawned. Which then stops spawning tombs because there already is one on top of it. But if the player walks out of its range, then no tombs are spawned anywhere.
What I want is: Each ground piece checks seperately and constantly whether the player is in range and if so, and the other criteria are met, it spawns a tomb
this is the code (a create event that sets an alarm, and underneath is the alarm)
Code:
if point_in_circle(player.x, player.y, x, y, 200) && instance_number(Tombspawn) < 5 &&
!instance_exists(tombcheck) && (myTomb == noone || !instance_exists(myTomb)) {
instance_create_layer(x, y, "spawners", tombcheck); myTomb = instance_create_layer(x, y,
"spawners", Tombspawn); alarm[0] = 3*room_speed; }
tl/dr: During the entire game currently only one tomb spawns. It should be spawning constantly everywhere