How do I count bullet collisions?

Get help using Construct 2

Post » Mon Apr 14, 2014 7:57 pm

So I've got some bullets. They bounce off of solids. I want them to disappear after three of those bounces. How do I do that?

I thought it would be as simple as adding 1 to an instance variable with each bounce, then destroying the bullet when that variable reaches 3, but the problem is that there doesn't seem to be any kind of 'on-collision' event. There's 'on-collision-with-a-specific-object', but not 'on-collision-with-any-solid' by the looks of things. Surely I don't need a separate event for every solid object in the game?

So, um, what do I do?
B
8
S
1
Posts: 54
Reputation: 824

Post » Mon Apr 14, 2014 8:19 pm

Create a Family with the objects you want it to collide against and then test vs that.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Mon Apr 14, 2014 9:03 pm

Thanks a ton! Shame families are only in the full version.
B
8
S
1
Posts: 54
Reputation: 824

Post » Mon Apr 14, 2014 9:16 pm

Just a thought , what if you compared the bullets angle and then added to a variable , according to the manual............AngleOfMotion
Get the angle the bullet is currently moving at (which can be different to the object's angle), in degrees. This changes when the bullet bounces , might be worth a try ?
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], brunopalermo, jorgmaquoi, kiki4construct and 24 guests