0 Favourites

How do I make an enemy come close from a distance?

  • I'm trying to make a game similar to 'Operation Machine Gun', But mine is going to be 2D.

    I want to make enemies appear from a distance and come close up to a certain point. So they appear at the top, and come closer (downward).

    Just increasing the size and moving the character downward won't give a very good effect.

    Can you please help?

  • Hi, you can spawn your enemies on top then give them the bullet behavior with an angle of motion of 90 to move down.

    Then, to satisfy your "come closer" request, you add a condition that once the enemy has traveled X amount such as 200 then set his speed to zero.

    That way enemies will spawn on top, move down for 200 and stop.

    TIP: use invisible sprites to move stuff and PIN the graphics on top. That way you don't have to worry about angles and bad collisions.

    Good luck!

  • Hi, you can spawn your enemies on top then give them the bullet behavior with an angle of motion of 90 to move down.

    Then, to satisfy your "come closer" request, you add a condition that once the enemy has traveled X amount such as 200 then set his speed to zero.

    That way enemies will spawn on top, move down for 200 and stop.

    TIP: use invisible sprites to move stuff and PIN the graphics on top. That way you don't have to worry about angles and bad collisions.

    Good luck!

    That is great, thank you.

    But isn't there a way to increase size as the sprite moves down? So that it'll give the sprite a feel of depth as well?

  • Sure there are several ways.

    • You can increase the SCALE of the enemy by a little bit every X seconds or every tick.
    • You can assign SINE behavior to the enemy with the SIZE setting

    You can start whichever method ON OBJECT CREATED and 2nd condition IS MOVING so that it stops doing that once it is stopped.

  • Wow thankyou so much

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Wow thankyou so much

    Happy to help

    Glad that it was useful for you

  • also could use variables, so that every time the enemy moves it adds 1 to distance traveled variable, when distance traveled variable = target, add 1 to scale variable. that should effectively scale their distance to their relative closeness. you can also use this to add x to speed, so that as they get closer they move faster.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
313 24,096
Colludium's avatar
Colludium
Unread hot topic
167 14,513
DMT2005's avatar
DMT2005
Unread hot topic Locked topic
115 17,215
Kyatric's avatar
Kyatric Construct Team Support