Fangames > Programming Questions

Bullets and invisible blocks problem

(1/1)

128-Up:
How do you make it so that bullets can be stopped by invisible blocks (only after they've been touched) and fake blocks (only before they've been touched), as well as the usual regular block object stopping them?

The closest I've gotten is having the fake block part work but not the invisible block part worked (meaning they stop the bullets while still invisible).

klazen108:
Just check the the bullet object. There's a collision with block event there that destroys if it collides with a block, right? Try this in that event:

--- Code: ---if (other.object_index==invisibleBlock || other.object_index==fakeBlock) {
    if (other.visible) instance_destroy();
} else instance_destroy();

--- End code ---

Assuming all those blocks have block as their parent, then if the block is an invisibleBlock or fakeBlock, only destroy if visible. Otherwise, just destroy.

Change the names if they're not the same, and if the parents aren't block, just make a new new collision event for them. Should work just fine!

128-Up:
For some reason, the unseen invisible block is still destroying the bullets...

Is there anything else that might help?

L4Vo5:
Locate the collission event that destroys the bullet. Just putting "if other.visible = 1" before the "instance_destroy()" should work. Otherwise it might be a problem with the exact code. In that case you should paste the code here so we can (maybe) see the problem

Navigation

[0] Message Index

Go to full version