[Solved] Enemy Facing/Image Direction Issue

0 favourites
  • 4 posts
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • So I have an enemy that I want to face the player.

    It's a 2D platformer.

    The player can jump over the enemy and I want the enemy to face the player from both sides.

    I use the program code below to do this.

    player | X < enemy.X | enemy | Set Mirrored

    player | X > enemy.X | enemy | Set Not Mirrored

    Now this works perfectly for ONE of the enemies, but not duplicates of the same type of enemy.

    How do I make all the enemies of the same type face the player?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • what event triggers this code?

    you most likely need to go through all the enemies on the screen. Use a For Each loop (which will run completely in 1 tick). You should put all your enemies in a Family as well.

  • That's because with the order you used you're picking the player, and not the enemies.

    Instead of

    player | X < enemy.X | enemy | Set Mirrored

    player | X > enemy.X | enemy | Set Not Mirrored

    You use

    enemy | X < player.X | enemy | Set Mirrored

    enemy | X > player.X | enemy | Set Not Mirrored

  • 7Soul

    Thank you!

    What an easy fix!

    Thank you!

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