Make multiple enemies with Pin behavior?

0 favourites
  • 7 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I want to make enemies that have some complex animations (running, idle, attacking in different ways, etc.), so I want to use the Pin to collision box approach for all of them, but when I applied the Pin behavior as one normally would for an animated sprite, the enemy sprites don't stay 'pinned' to the collision boxes unless there is only one in the layout. I hope I'm being clear. How does one make this happen with multiple enemies?

  • When dealing with multiple instances of the same object, I usually use Every Tick --> Set "EnemyCollision" position to X: Enemy.X | Y: Enemy.Y

    I would have to make a .capx to test this, but this should work. If it doesn't, it might require something to spawn a duplicate "EnemyCollision" at the same time as the Enemy object. I'll check it out though.

  • I see...I think. I'm going to have to experiment, but if I'm reading you correctly, you basically did the inverse of what I attempted. Instead of putting the enemy collision boxes on the layout and pinning the sprite to them, you basically put the enemy sprite on the layout and set the collision box's position to the sprite, having that control all the collisions in the events.

    I'd love to see what your .capx turns up.

  • I had a bit of a breakthrough: I added an event that said "Every Tick, For Each enemySprite --> set enemySprite position to enemyBox" and that seems to work for multiple instances.

    Now I need to figure out how to get them to not completely match each other's movements...got them walking but when one turns around, they all turn around, resulting in some of them appearing to be moonwalking...

    Also, defeating one enemy destroys every sprite instance...this is frustrating.

  • Hmmm, interesting. Could you provide a capx? Then I can see what I can do

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm sorry, I can't...part of a much larger project that I've put a ton of work into. But I think I may have found the help I needed from a friend. He helped me figure out that I need to use the enemy box to spawn the enemy sprite (kind of like what you suggested), and code it so it uses an instance variable within the enemy collision box object to pick sprites by their UID. I'm still working on applying the advice he gave me and I'm going to see if it works out.

    But I'll leave this thread up in case you or anyone else has anything they might want to add...a simpler way, etc.

  • kk sounds good!

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