Support character should face the enemy he’s shooting at, even while moving

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Controller Support ,TouchScreen Support , Keyboard Support , Action Platformer, Lots of Animations
  • I have a Hero, a Support character, and multiple enemies on screen coming from both sides of the layout.

    I want the Support character to:

    - Pick an enemy and shoot at it.

    - Follow the Hero if the Hero moves.

    - Always face the enemy he’s shooting at, even while moving, whether moving forward or backward.

    I tried using the Turret behavior for the Support character, but it’s not working well. I also couldn’t get him to mirror correctly toward the enemy he’s shooting at. I’m currently using the Platform behavior for movement.

    Can you please help me figure this out?

    What combination of behaviors and events can give me the result I’m expecting?

    Events:

    Gamepage:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would start with the pick enemy logic, so whatever enemy is picked you can have its UID set as a variable on the support char so you know which enemy is connected (support.var). You didn't mention how it is picked but for example if it is the nearest enemy to player you can do that, pick enemy nearest to player and set support.var to enemy.UID

    Then this helps solve the facing issue, you say pick enemy where UID = support.var, if support X is less or greater than the enemy then mirror the support char accordingly.

    For shooting depending on how simple it is, if its just left or right then you can fire bullets and set the angle based on if the support char is mirrored or not, either 180 or 0. If it is more complex angle of shooting then you can just pick the enemy by UID support.var again and set the bullet angle towards the enemy.

    The support char would then stay mirrored or not based on the enemy X so you are free to move the support char in terms of following the player how you wish.

  • I would start with the pick enemy logic, so whatever enemy is picked you can have its UID set as a variable on the support char so you know which enemy is connected (support.var). You didn't mention how it is picked but for example if it is the nearest enemy to player you can do that, pick enemy nearest to player and set support.var to enemy.UID

    Then this helps solve the facing issue, you say pick enemy where UID = support.var, if support X is less or greater than the enemy then mirror the support char accordingly.

    For shooting depending on how simple it is, if its just left or right then you can fire bullets and set the angle based on if the support char is mirrored or not, either 180 or 0. If it is more complex angle of shooting then you can just pick the enemy by UID support.var again and set the bullet angle towards the enemy.

    The support char would then stay mirrored or not based on the enemy X so you are free to move the support char in terms of following the player how you wish.

    Thank you, i would try this

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