How do I Have Realistic Collision?

Get help using Construct 2

Post » Sun Jul 26, 2015 3:21 am

So I've decided to try my hand at an android game, and while it isn't super far in development I have high hopes for it.
I've run into a few problems, though
(It's an endless runner, like a 2D temple run)

I want my character and obstacles to have realistic movement when there is a collision. For example, if the character (an egg) runs into a loaf of bread, I would want the character to trip and the bread to get hit and roll or whatever. This way it would save me some animation time, like if you were to run into a pan I wouldn't have to animate it swinging back and forth but instead have it done for me.

The only way I can think of making this possible is using the physics behavior, but after fiddling with it I haven't had much luck. If anyone could give me some suggestions I would eternally grateful, and should the game ever be released, I will credit you in it.

Thanks! :D
B
8
S
1
Posts: 15
Reputation: 1,487

Post » Sun Jul 26, 2015 3:46 am

Oh and a capx can be given if requested
B
8
S
1
Posts: 15
Reputation: 1,487

Post » Sun Jul 26, 2015 7:30 am

You definitely want to use the Physics behavior. But it does take some experimentation to learn how to use it.

Just understand that in order for two objects to collide using Physics, they both must have the Physics behavior. This means your ground will have a Physics behavior, with "immobile" set to true. Your player and your items will have a Physics behavior as well.

It's not the easiest behavior to work with, but with lots of tweaking and experimentation, you can get some interesting results.

Also look into the Chipmunk physics plugin if you need more joint types and extra functionality.
B
12
S
4
Posts: 48
Reputation: 910

Post » Sun Jul 26, 2015 7:36 am

With all the different movement-behaviours any movement can be programmed, but it might take some time to get it to look the way you want..
I wouldn't recommend using physics if you are not going to make everything in your game physics..

For the bread to get hit and roll I guess using the bullet behaviour with gravity could be of use..
the tripping of the character could be done with the platform behaviour by setting the vectorX and vectorY and maybe messing around with setting the angle..
Setting the character to ignore input while a certain instance variable is set would probably be wisest and you might want to use the timer behaviour to time the different actions during this period..

Although it might take some fiddling, the outcome could be pretty cool..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jul 27, 2015 9:39 pm

Thanks guys! I'll definitely play around with the physics behavior more. Hopefully I can get this running
B
8
S
1
Posts: 15
Reputation: 1,487


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests