0 Favourites

Manage multiple, overlapping pinned objects

  • 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]
    
  • 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. :)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,515
DMT2005's avatar
DMT2005
Unread hot topic
123 14,874
Zebbi's avatar
Zebbi
Unread hot topic
0 Favourites
Isometric multiple floors
74 9,719
eleanorawesome's avatar
eleanorawesome