Bullet hits anything

0 favourites
  • 7 posts
From the Asset Store
UID TO ANYTHING
$11.25 USD
50% off
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • 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 don�t 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

    It?s 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 there?s something interesting there.

  • The families, i think have the same problem.

    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.

  • But would?t 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?

  • But would?t 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?

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)