How do you bounce your main actor in a top down?

Get help using Construct 2

Post » Sun Jul 28, 2013 11:40 pm

Hello all.

I have a round-shaped main character who is in a top down game. There are other round-shaped NPCs in the game, NPCs who move. When the main character and the NPCs collide I wish to have them both bounce away from each other.

In order to try to make this happen I have tried the following...

Given both of them physics and tried adjusting the elasticity and density of the objects.

Created an event where upon collision an impulse tries to push the player away from the impact.

With everything I've tried, the main character just pushes through the NPC with no real impeding of its movement, or the NPCs get thrown away violently.

Am I missing something? Is there any way to do this?iso2502013-07-29 00:09:48
B
10
S
3
G
1
Posts: 30
Reputation: 1,279

Post » Mon Jul 29, 2013 3:08 am

Have you looked into the bullet behavior? It doesn't have to be used for movement, it gives you the "bounce off object" action you can call yourself on both who collide.
B
226
S
60
G
33
Posts: 902
Reputation: 39,955

Post » Mon Jul 29, 2013 3:55 am

if you still want to use physics
leave events completely.. just give both elasticity of somewhere between 0.5 and 1

also, linear damping is normally for the effects of air resistance... but for a top down game you should treat this like it's the character acceleration/deaccel. So set it relatively high.
it lets you have a reasonably fast player without feeling slidey
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Mon Jul 29, 2013 4:24 am

Thank you both for your replies.

I've been tinkering around with physics and it seems that if your character is travelling right and hits something whilst you're still holding down the right key, you don't bounce. It's like the holding of the right key overrides the bounce action. I've tried momentarily turning off the 8Direction upon collision but it produces very haphazard results.

I tried Bullet motion for moving the character, leaving 8Direction completely alone, and that seems to work. The only difficulty is if you want to change the speed of the character you need to change the density and linear damping to avoid some very wacky results. It's a shame that my game requires a high number of speed changes!!

I think this is going to take a lot more testing. If you have any more ideas I'd be most appreciative, though!!
B
10
S
3
G
1
Posts: 30
Reputation: 1,279

Post » Mon Jul 29, 2013 7:44 pm

Bullet is not working either. The best way seems to apply force by using physics. That way you don't have a defined speed to override the impact. Very touchy to adjust, though.
B
10
S
3
G
1
Posts: 30
Reputation: 1,279


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Yahoo [Bot] and 4 guests