Manage multiple, overlapping pinned objects

0 favourites
  • 4 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hi all!

    Hope you can help, having lots of fun on a game I can't wait to show you but right now I'm a bit stumped.

    When I have more than one enemy hit by touch, then they each take damage and "die" correctly, but the associated health bars don't all get picked up. Only one does.

    <img src="http://i.imgur.com/6HcRYAO.png" border="0" />

    I can't figure out what do to.. Are any of the following possible?

    1, Prevent touch/click hitting multiple overlapped family objects (so, only hit the top one..)

    or

    2, How to fix the issue with "only one" health bar being found in the for loop, even though multiple "Prey" are picked.

    or

    3, How to assign health bars to family at run time via a family container (then hp bars would destroy with enemies). Don't think this is possible.

  • 1. You could use 'pick top instance' in the first event

    +Touch: On touched Prey
    +Prey: Speed = 0
    +Prey: Pick top instance
    

    2. You need to loop through the prey as well:

    +System: For each Prey
    +System: For each HealthBar
    +System: Compare two values [HealthBar.Pin.PinnedUID = Prey.UID]
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm starting to think you are the forum superstar here! I'll give those a try, thanks. :)

    Have gone with option 1, makes more sense. :)

  • 1. You could use 'pick top instance' in the first event

    > +Touch: On touched Prey
    +Prey: Speed = 0
    +Prey: Pick top instance
    [/code:3scu8zr2]
    
    2. You need to loop through the prey as well:
    [code:3scu8zr2]
    +System: For each Prey
    +System: For each HealthBar
    +System: Compare two values [HealthBar.Pin.PinnedUID = Prey.UID]
    [/code:3scu8zr2]
    

    This was very useful for me. Thank you

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