enemies just bug after a while, when there's more than one on the same screen.

0 favourites
  • 2 posts
From the Asset Store
40 short musical loops, perfect for playing in the background on different screens.
  • Here I am once again to try to solve some problem in my game in construct 2.

    This time it's with enemies. I was planning and making some enemies for my game until this problem occurred to me. It's not the first time it's happened and this time I thought I'd fixed it.

    I had redone this enemy's programming (his old AI was a mess!) making it more organized. The problem is that when you have more than one of them on the screen they just break. sometimes it takes a while for them to be like in the video, and sometimes it happens very fast.

    animation hangs in an infinite loop, it no longer skips or cancels any animation. if there are 4 together on the screen the bug is immediate. I've done everything, swapped events, added conditions, etc. and nothing happens ;-;

    every enemy event happens in a loop (for each) for each collider of each enemy.

    they have an ammo counter to count how many times they shot, a timer of when they should attack and a detector called "shoot_attack" to know if the shot will be at close or long distance.

    I honestly don't know what to do and I ask for your help here on the forum. I'll leave a video and photos to give you an idea of ​​how the whole process works.

    dropbox.com/s/hbek5zthjkv18mj/Desktop%2025-08-2022%2020-50-54.avi

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's impossible to understand what's going on in your code. But you are definitely using "Trigger once" wrong. You should never use it with objects that have multiple instances - this may cause nasty bugs which are very difficult to track.

    Don't use "Trigger once" in loops or as a single condition in a sub-event. Don't use it as the first condition in an event. In fact, better don't use at all unless you have a clear understanding of how it works.

    If you want, for example, to change the animation only once, use "Animation is NOT playing" condition instead of "Trigger once".

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