Ok, so I got this idea of a game where you blow stuff up... but now I'm kind of stuck. Anyway, the problem is that I'm doing an overlap for my tank *and* the bullet that hits it. The tank must first detect if the bullet has hit it so it knows to explode, then the bullet must somehow check if it has hit the tank so it too disappears.
However, I can't have an overlap layer for bullets WHILE I detect for a collision using the bullet image or it overlaps with itself :S I tried using a field for my tank type called "goboom" so that...
- tank overlaps with bullet, tank.goboom=1
- resetcollisions so we don't still have the bullets collision layer loaded.
- load tank collision layer
- bullet overlaps with tank, bullet is deleted
- if tank.goboom=1 then tank.kaboom()
but goboom only equals 1 WHILE they're overlapping, the bullet will die then there won't be a bullet to overlap with the tank by the time I get to that part where the tank is meant to explode. I also considered doing something like when the tank is hit a tracer (another type) would appear on the tank, then after the bullet explodes, all tanks with the "tracer" on them would also explode. But this leads to all kinds of new problems.
Is there some proper way to do this that I was too stupid to notice or is it to do with lists? Because I saw an example of overlapping where overlapped things would go into a list... then bm would run a check and tell everything in the list to do a certain method. If thats true then could someone please explain how you check if something belongs to a list and do whatever action?
Thanks in advance, now I'll probably take a break from programming and play a game or throw myself through a few closed windows in frustration. Either way I should be back here soon to check up on replies. If you think I've did a sad job explaining or whatever please tell me :)
- goodbye my beloved programming community :)
However, I can't have an overlap layer for bullets WHILE I detect for a collision using the bullet image or it overlaps with itself :S I tried using a field for my tank type called "goboom" so that...
- tank overlaps with bullet, tank.goboom=1
- resetcollisions so we don't still have the bullets collision layer loaded.
- load tank collision layer
- bullet overlaps with tank, bullet is deleted
- if tank.goboom=1 then tank.kaboom()
but goboom only equals 1 WHILE they're overlapping, the bullet will die then there won't be a bullet to overlap with the tank by the time I get to that part where the tank is meant to explode. I also considered doing something like when the tank is hit a tracer (another type) would appear on the tank, then after the bullet explodes, all tanks with the "tracer" on them would also explode. But this leads to all kinds of new problems.
Is there some proper way to do this that I was too stupid to notice or is it to do with lists? Because I saw an example of overlapping where overlapped things would go into a list... then bm would run a check and tell everything in the list to do a certain method. If thats true then could someone please explain how you check if something belongs to a list and do whatever action?
Thanks in advance, now I'll probably take a break from programming and play a game or throw myself through a few closed windows in frustration. Either way I should be back here soon to check up on replies. If you think I've did a sad job explaining or whatever please tell me :)
- goodbye my beloved programming community :)