'Planet' on collision with 'Planet'?

0 favourites
  • 8 posts
From the Asset Store
Photoreal planets rendered over transparent. Five different resolutions and phases for each planet. Also includes Space
  • Hi guys,

    If i had the a physics object called Planet which has different animations then setup the following event.

    -'Planet' on collision with 'Planet'

    --------Is animation 'default' playing? -> 'Planet' destroy.

    --------Is animation 'sun' playing? -> ?????

    This would give me the following results in game.

    -In a planet vs planet collision both planets would be destroyed.

    -In a planet vs sun collision only the planet would be destroyed.

    However, In a sun vs sun collision I want both suns to be destroyed, but I don't know how to separate the two instances to compare them. Is one self and the other planet?

    Thanks in advance.

  • Why not put the Planet in a family as well, then do the collison checks between Planet and Family(Planet).

  • spongehammer Thank you. That is a helpful suggestion and I will probably end up doing it that way. However, I was kind of hoping for something more elegant i.e. built in functionality. If it doesn't exist then that's fine.

    Edit: Gahhh... I cannot access the planet's instance variable through a family. So unfortunately that wont work

  • Here's how you could do it with a for each. Much more complicated than just using families though...

  • Always put important objects in a Family IMO, with the instance variables on the family

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, a free scrub like me can't use families. You *could* probably go:

    On Collide Planet (sun) -> Planet (sun)

    --System -> Pick Nth Instance Planet (sun) 1 | Planet -> Destroy

    --System -> Pick Nth Instance Planet (sun) 0 | Planet -> Destroy

  • Yup, and it's indeed easier than looping. I always thought "pick nth instance" used IID, but I was wrong ! Here's the updated capx.

  • Magistross




    Thanks for your help guys. I actually avoided the situation in the end by creating separate objects for each type. However, I do come across this problem semi-regular so I'll be sure to try this nth instance trick.

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