How do I Detect When my Bullet has Bounced?

Get help using Construct 2

Post » Fri Jun 24, 2016 7:38 pm

Then that 'angle change' seems a neat idea.
Just use the sprite.bullet.AngleOfMotion expression, it can differ a lot from the sprite.angle.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jun 25, 2016 9:54 am

I am already. There are a few other sprites pinned to the bullet which give me usable angles for everything else thankfully, the bullet is JUST used to control movement angle of the collection of sprites so haven't used its common angle property at all.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Sat Jun 25, 2016 10:02 am

If it's just one bullet, I wouldn't be concerned with performance issues simply calculating collision.

As already suggested, anything the bullet can "bounce" off of, just add it to a family and make a single event (if bullet collides with family -> do stuff).

That would easily be the, easiest solution.

If you had zillions of bullets, then using angle comparison might be better, but for a single bullet (or even 100 bullets) I wouldn't bother with a complex solution like that.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Sat Jun 25, 2016 4:50 pm

As discussed before, this would involve multiple families, multiple events, and it turns out an excess of collision detection. Angle check works like a charm using a single event. Alternative took ~15 events and made an absolute mess of the rest of the capx adding unnecessary properties to objects by family etc. Marking solved.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Sun Jun 26, 2016 3:59 am

You have one bullet colliding... there's not "multiple collision checks".

If your bullet is bouncing and producing the same particle effects no matter what it's hitting (I assume it is, because checking for angle change is going to give only a single result with nothing else to compare) then you only need ONE family with EVERY object that can be collided/bounced by the bullet.

It's up to you how you do it, but either way would work fine and performance would be (probably) the same.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Sun Jun 26, 2016 10:02 am

Only if every object in that family has its solid enabled, which it doesn't, and only if all objects required for collisions are of the same object type, which they're not. As I said - I tested both methods, it's more efficient and easier to read an angle check. All of these things have been discussed earlier, you should really read the thread before posting.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Previous

Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223, brunopalermo, PROxMTswatTR and 34 guests