Counting the number of overlapping sprites (SOLVED)

  • In my game I have small bee enemies that attack the player in groups. I want them to do x amounts of damage per second per bee, but no matter the amount of bees overlapping the player it only accounts for the damage of one bee, not 10 for example. Is there a way to count the number of sprites overlapping another sprite so I can just multiply the damage of one bee by the total number of overlapping bees. Or is there a way for every bee to do individual damage on the player? All I have tried is; (bee) overlapping (enemy), every (1) seconds -> (enemy) subtract (x damage) from ( health). I don't get why this doesn't work, but I haven't tried much. Thanks to anyone who can help.

  • You could use For each enemy, or use enemy.Count to answer you question directly.

    Correction: should be PickedCount, as 99Instances2Go points out.

  • every (1) seconds

    (bee) overlapping (enemy)

    (enemy) subtract (x damage * bee..PickedCount) from ( enemy.health)

    health must be a instance variable

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys, it work perfectly.

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