Bullet hits anything

Get help using Construct 2

Post » Mon Jun 24, 2013 8:16 pm

Hi

I`m trying to have a bullet be destroyed if it hits any solid object. If it hits a wall, the celling, the floor, the player, etc; since I have lots of sprites that build the stage.

So far, the Overlaping events need to choose a particular object to do something, and I dont want to do the same thing for n different objects.

Is there a way to have the bullet trigger an action when it hits anything solid?

thanks.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Mon Jun 24, 2013 9:30 pm

You are using the free version, right? Then you can't use families, which would be the easiest way...
The only other way of doing this is making your event an 'or' block, so you'll have:

Bullet collides with A
or
Bullet collides with B
or
Bullet collides with C
-> Destroy

(to make an 'or' block, right click the event and select "Make 'Or' Block"

And you can make it a sub-event of a blank event, just so you can hide it and it doesn't look like a mess
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Mon Jun 24, 2013 9:34 pm

That's where you need families, which are only available in the paid-for versions of Construct 2. This allows you to bundle together similar objects into a single family, which is called as one object in an event.

Your other option is to create a single collision object that's duplicated all over the layout, and overlaps everything you want to count as such an object. Set it to invisible.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Tue Jun 25, 2013 2:04 am

Thanks

Thought about the OR chain, and found it very complicated. On a large project could become unmanageable really fast. The families, i think have the same problem.

Its odd because it has a flag to bounce off solids, so it clearly can react to every solid in the game.

BTW, I added a 8-way behavior to the bullet, and theres something interesting there. perezbalen2013-06-25 02:07:21
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Tue Jun 25, 2013 2:20 am

[QUOTE=perezbalen]The families, i think have the same problem. [/QUOTE]

Not at all.
In a single event "on collision with family" the deal is done.

And in the family editor, that's where you add the several objects you want.

You could then have a family for objects that will destroy the bullet, have a family for objects that will act different and be aware that a same object can be assigned to different families.

Have a look at the manual entry to have a better overview of the family feature.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,328
Reputation: 71,288

Post » Tue Jun 25, 2013 3:14 am

But wouldt this mean that I have to have a family with ALL the solid objects in the game? and could I then use the family feature to create another family with the monsters, but not the walls?
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Tue Jun 25, 2013 6:06 am

[QUOTE=perezbalen] But wouldt this mean that I have to have a family with ALL the solid objects in the game? and could I then use the family feature to create another family with the monsters, but not the walls? [/QUOTE]

You could have a family called BULLETS-HIT-THESE-THINGS and put every object you want bullets to hit in it. Then in events, you can check if bullet collides with BULLETS-HIT-THESE-THINGS family. You can also have object belong to multiple families, so it's a really versatile system.
B
24
S
9
G
7
Posts: 756
Reputation: 7,312


Return to How do I....?

Who is online

Users browsing this forum: draiza, Kyatric, R0J0hound, zenox98 and 8 guests