Enemy Box and Animation

0 favourites
  • 7 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Hi

    I?m scratching my head with this one, as it shroud be very easy, yet I can?t find anything on the tutorials or forums.

    I use a red box as an enemy, and I have plenty. Yet I want the box to be invisible, and attach an animated spite to it (using the Pin behavior).

    So, I do:

    EnemuBox On Create -> EnemyBox Spawn EnemySprite

                       -> EnemySprite Pin to EnemyBox

                       -> EnemySprite Set Position to Enemy Box

    EnemyBox is Moving    -> EnemySprite Set Animation to "WalkingAnimation"

    The thing is that all my enemies are acting like choreographed dancers. When one plays the wlakingAnimation, all do. And I can?t figure a simple way to encapsulate the Box and the sprite animation.

    Thanks

  • If you aren't using parenting, that solved similar problems that I was having. Parenting and event groups will help a lot. Also, make sure you delete all cloned and parented objects at the start of the layout.

  • I always add a linking 'id' variable that is the moving object's UID. So 'enemyBox is moving + enemySprite.id = enemyBox.uid -> Set Animation...'

    Maybe there is an easier way, but I use the id variable for so many things anyway that this is how I manage it.

  • how do I use parenting?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • how do I use parenting?

    Click on an object and in the properties section there should be a "parent" thing. Anything that is parented to something will be created with the object and deleted with the object, so you don't even have to do those things when handling the original (parent) object.

    I didn't have to use UIDs at all doing this, but always make sure you reference the parent object in the events and not just the actions when handling parented objects.

  • Sushin

    perezbalen

    It is called containers

  • Sushin

    perezbalen

    It is called containersI think that's what I meant...instead of parent.

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