M
Mael
Guest
Hello there!
I am working on a big project for quite a time now, so I am pretty familliar with gamemaker now. Everything works fine until I try to add a coin system. Here the explanation:
I have an obj_ball that you can flick. I also have an obj_coinBrown.
In the obj_ball step event I coded this:
// With a brown coin
if (place_meeting(x, y, obj_coinBrown))
{
with other instance_destroy();
global.coins += 1;
drawCoins = true;
alarm[0] = room_speed * 3;
}
All of this works fine, but my game crashes when colliding with a coin because the obj_ball gets destroyed too. I tried all different methods aswell but either it doesnt detect the collision or the ball gets destroyed again. For example I tried getting the ID of the coin that collides but no change of results.
Can someone please explain to me why my obj_ball gets destroyed over and over again?
Thank you very much!
I am working on a big project for quite a time now, so I am pretty familliar with gamemaker now. Everything works fine until I try to add a coin system. Here the explanation:
I have an obj_ball that you can flick. I also have an obj_coinBrown.
In the obj_ball step event I coded this:
// With a brown coin
if (place_meeting(x, y, obj_coinBrown))
{
with other instance_destroy();
global.coins += 1;
drawCoins = true;
alarm[0] = room_speed * 3;
}
All of this works fine, but my game crashes when colliding with a coin because the obj_ball gets destroyed too. I tried all different methods aswell but either it doesnt detect the collision or the ball gets destroyed again. For example I tried getting the ID of the coin that collides but no change of results.
Can someone please explain to me why my obj_ball gets destroyed over and over again?
Thank you very much!