How do I bounce from collision of swords?

  • Hello all, im currently creating a game that is inspired by the classic zelda games.

    In that regard im trying to program a way for the main character to bounce off of enemy's when weapons collide.

    sort of like when players weapon on collision with enemy's weapon- bounce the character backwards, also bounce the enemy backwards. enemy's and the main character are using the 8 direction function since this is top down view.

    any thoughts?

  • I havent' been able to get a reply since the spam bots showed up. anyone have any idea's?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add a bullet behaviour to both but disable by default.

    Then on collision..

    local anglePlayerEnemy

    anglePlayerEnemy = angle( Player.X, Player.Y, Enemy.X, Enemy.Y )

    Player 8direction disable

    Player bullet set angle of motion to anglePlayerEnemy + 180

    Player bullet enable

    Enemy 8direction disable

    Enemy bullet set angle of motion to anglePlayerEnemy

    Enemy bullet enable

    Wait 0.5

    Player bullet disable

    Player 8direction enable

    Enemy bullet disable

    Enemy 8direction enable

    Set the bullet speed to something like 30.. you'll need to tweak this and the wait 0.5s to get the result you're after.

  • This is perfect! the local Variable wouldnt work but a global one worked just fine, Thanks so much!

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