How do I Have Realistic Collision?

0 favourites
  • 5 posts
From the Asset Store
2D realistic cloud pack has 11 different clouds included.
  • 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!

  • Oh and a capx can be given if requested

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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..

  • Thanks guys! I'll definitely play around with the physics behavior more. Hopefully I can get this running

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