How do I get an enemy to return to its original path?

0 favourites
  • 2 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • I have an enemy running around in a circle. The enemy will break this circle when the player enters its line of sight. Upon the player leaving the line of sight of the enemy, the enemy will resume its circle at the new point. How would I get the enemy to return to its original position and resume its circle again?

    The circle is coded as such:

    ----------------------------------------------------------------------

    Every Tick:

    enemy: >Move forward 1.5 pixels

    >Set angle to enemy.angle+0.96 degrees

    ----------------------------------------------------------------------

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just store the starting position and angle. Then do;

    ----------------------------------------------------------------------

    Every Tick:

    enemy: >Move forward 1.5 pixels towards starting position

    Set angle to starting angle.

    ----------------------------------------------------------------------

    Then do a comparison to see if the player's position and angle is equal to the starting values. At which point you tell the enemy to resume its original behavior.

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