[Solved] Shoot off limbs + make them fly in right direction

0 favourites
  • 4 posts
From the Asset Store
Fly Bound
$2.49 USD
Design for game, asset for game, game kit, UI design, completed design for game FLY BOUND
  • Heyho,

    I am making a top down shooter, kind of. I made a simple enemy puppet that is chasing the player. It has got a body, a head and 2 arms. The arms and head are pinned to the body. Now when the player shoots at the enemy and a bullet hits one of the arms, I already get it to

    a) not be pinned anymore to the body

    b) fly away from the body pretty fast and decelerate until it stops using the bullet behavior

    But right now the arms are flying straight forward, like if the enemy is launching them like rockets. In order to make this look good the arms actually have to fly a way in the opposite direction from where the player is standing and shooting. Do you have any idea how exactly the code could look like to achieve the effect?

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe if you make the speed value negative or something like that?

  • Setting it to negative doesn't work. Remember, we have a top down view, so basically a coordinate system with a X and Y position for the player and a X and Y position for the enemy.

    I also tried to get the angle with this method "angle(X1, Y1, X2, Y2)". I set up a global value called AnglePlayerEnemy and set this every 0.1 sec to "angle(player.x, player.y, enemy.x, enemy.y) and when the a bullet hits the enemy's arm I tell the arm to set the bullet angle of motion to the AnglePlayerEnemy value ... but it doesn't work.

    edit:

    Alright, the closest I got so far to a somewhat accurate outcome is to tell the enemy's arm to "Set angle toward ((player.x),(player.y))". So at least we get the right angle between the player and the enemy. Only thing the arms are now firing straight at the player when they should go in the opposite direction. Now we just need to invert this value somehow. I tried some variations of adding a "-" or a "-1* whateverthepositioniscalled", but nothing works properly ... any suggestions?

    edit2:

    solved.

    EnemyArm set angle to angle(player.x,player.y,enemyarm.x,enemyarm.y)

  • Didnt know that

    Thanks for sharing and congratulations for finding out!

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