Enemy Not Working in Level 2 After Playing Level 1

Not favoritedFavorited Favorited 0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Can you guys please help me fix this issue?

    I’m using the same enemies for all levels, so I created a common event sheet, added enemy functions there, and attached that event sheet to all level event sheets.

    The problem is that the enemy works correctly in level 1 but not in level 2 or later levels.

    I did the same thing for the Hero.

    I created a common event sheet for the Hero, attached it to all levels, and it works perfectly.

    However, if I preview level 2 directly, the enemy works fine. Also, if I copy the enemy function control group directly into the level 2 event sheet, the enemy works fine. It only stops working when I go to level 2 after playing level 1.

    Strangely, even though the enemy doesn’t work at first, if I die and restart the level, it starts working fine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, can you post a screenshot of your enemy code? Or if you feel like it, share your project? Thanks

  • Also, if I copy the enemy function control group directly into the level 2 event sheet, the enemy works fine.

    You mentioned that the all levels share the same event sheet?

    If the enemy code is on a different event sheet, you need to include it into other sheets. Right-click on an empty space and choose "Include event sheet".

  • Thanks for the input guys,

    I found the bug,

    Cause:

    When I killed the enemy, I deactivated the enemy movement group. Since group states persist across layouts, it remained deactivated in the next level, preventing the enemy from functioning.

    Solution:

    I simply activated the enemy movement group at the start of the layout, which fixed the issue.

    Lesson Learned:

    Group activation states are global unless the layout is restarted. Always reset necessary groups at the start of each layout to prevent unexpected behavior.

  • When I killed the enemy, I deactivated the enemy movement group

    This is not a good idea, it will only work if you have a single enemy. With multiple enemies disabling the event group will disable it for all enemies.

  • WackyToaster

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