Identify Pinned Object

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm doing a platformer game. As sugested by manual, I've created a rectangle object and pinned the animated sprite.

    Now, I'm trying to do the same with the enemies. What I've done is...

    On start layout, for each boundingBox:

    -boundingBox spawn enemy.

    -enemy set position to (boundingBox.X, boundingBox.Y)

    -enemy Pin Pin to boundingBox

    And it works fine.

    But how can I identify each enemy to mirror or change the animations depending on what is the corresponding boundingBox doing?

    Thanks,

  • Try this, if it's what you're looking for.

  • Thanks! That helped a lot <img src="smileys/smiley2.gif" border="0" align="middle" />

  • A bit buggy, but it does work.

  • Noga,

    Thanks, But can you increase the Enemy Speed ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I know that this is an old thread, but this page is still the top Google result for most search queries that I used concerning this problem. I didn't like the provided answer because it's too complex and may not work properly if two enemies are at the same position.

    After reading more help pages, I've finally managed to create a simple solution. I just wrapped my

    enemy movement functions within these conditions:

    System | For each Enemy_box
      System | Pick Enemy_sprite instance Enemy_box.IID
    [/code:3ovk367a]
    
    Since each of my enemy characters is created along with a box, all of them will have a paired IID. When a box hits a wall, only its individual corresponding sprite will be mirrored. I hope that this will be helpful for other beginners.
  • anewuser Your fix worked for me until I started destroying enemies. With each one destroyed, another would lose it's mirroring.

    This thread scirra.com/forum/viewtopic.php had another solution in TiAm 's file that worked for me. It ignores instance variables and doesn't use a bounding box which is weird but it's working for me so far!

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