Enemy bounce off player and then return to place?

0 favourites
  • 2 posts
From the Asset Store
Spooky Places game assets for 2D endless runner action adventure game.
  • I'm trying to figure out how to place an enemy with something simple like Sine movement, but when the enemy is struck with the players sword or comes in to collision with the player it will bounce off or get knocked back.

    This is doable, but the biggest issue I run in to is trying to have the enemy then return to the place it started at. I'm trying to keep it simple and make these enemies flying/floating type to avoid platform ai issues.

    I've used the bullet behavior but I'm guessing that I'll need to do that with a combo of path detection or something.

    Has anyone done this or know how to?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if player got hit then

    set value(player.oldY)to(player.Y)

    set player.bullet.angle to 270

    set player.bullet enable

    if player bullet=enable & if player.bullet.angle=270 & if player.Y - player.oldY > 100

    set player.bullet.angle to 90

    if player bullet=enable & if player.bullet.angle=90 & if player.Y = player.oldY

    set player.bullet disable

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