How do I bounce from collision of swords?

Get help using Construct 2

Post » Sat May 16, 2015 5:39 pm

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?
B
5
S
1
Posts: 88
Reputation: 653

Post » Thu May 21, 2015 12:00 pm

I havent' been able to get a reply since the spam bots showed up. anyone have any idea's?
B
5
S
1
Posts: 88
Reputation: 653

Post » Thu May 21, 2015 4:18 pm

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.
B
15
S
5
G
7
Posts: 876
Reputation: 5,650

Post » Sun Jun 07, 2015 3:40 pm

This is perfect! the local Variable wouldnt work but a global one worked just fine, Thanks so much!
B
5
S
1
Posts: 88
Reputation: 653


Return to How do I....?

Who is online

Users browsing this forum: jezjones24 and 7 guests