Attach Sprite to other sprite problem

0 favourites
  • 5 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • So by now I erached a point in my game where i have to place some enemies in a stage to test if their behavior does what it's supposed to do. So today i tried making a bat.

    The bat hangs on the ceiling and sleeps. if the player comes close, the bat wakes up and flies around frantically. it tries to get the player, so if the player is out of range (aka turret range) the bat flies somewhere else until the player gets in range again. If the player hits the bat it dies.

    So far everything i described here works like a charm. Here's what I did:

    i created a enemy box. since i dont want the bat to titl at any angle but till fly in any angle, i gave the box all functions and simply attached a bat sprite to the box. the sprite has two animations: sleep and fly. so for starters they sleep nd then they fly. This, as wll, works perfectly.

    Now here is my problem though:

    once ONE bat starts to fly, ALL bats start their fly animation, even though they still sleep. furthermore, once all bats aredefeated, the last bat i kill is NOT disappearing. its gone, technically but the sprite still shows and has the fly animation on loop.

    i did this:

    <img src="" border="0" />

  • Me thinks you need to use a For Each EnemyBatBox command, to prevent them from all going at the same time.

  • i tried that already but nothing changed.

    In fact i tried it for bats and batboxes. nothing changed with abts and with batboxes all bats started flying at the same time but only one was visible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are not picking the bat that belongs to the enemyba.

    The easiest way is to create a container. That way only the bat attached to the enemyba is selected.

    An other choice would be to add a condition - if enemybat is over enemyba. that way only the overlapping bat would be chosen.

  • i had a condition with overlapping but that didn't help either. I'll try a container and see how that goes^^


    And that worked perfectly. As simple as that! fantastic, thank you!

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