Physics & bounce off solids

0 favourites
  • 5 posts
From the Asset Store
Bouncing ball
$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
  • Hi all,

    I'm working on a golf game and getting concerned with my inability to streamline the behaviors and events involved. The player has platform behavior and the golf ball has physics behavior. When hit, the golf ball goes right through the tiled platform, though. So, I tried adding solid to tilemap, but realized that is for bullets bouncing off, not physics sprites. Research showed physics can bounce off other physics, so I gave the tilemap that behavior and it was acting fine.

    Now, there are other objects, platforms, enemies etc. that I may, or may not, want the ball to bounce off of, and the thought of adding physics behavior to those sprites seems like a recipe for a boggy game. Perhaps that's wrong thinking? I know I could group the sprites I want to have physics in a family, but is that really less processor intensive? They, essentially, all still have the physics behavior but just in the convenience of a group, yes?

    I tried adding bullet along with physics to golf ball just to get that bounce off solids ability, but I don't know how to assign the other bullet parameters so they don't affect the physics of the golf shot. Perhaps this is the best solution if someone could tell me how to set the bullet parameters so they don't intervene.

    I also tried adding platform behavior along with physics on the golf ball and that seemed okay, but again, not sure if this is gonna be boggy in the end of it all...

    It seems to me, the casual coder, that simply having a "bounce off solids" parameter in the physics behavior, like there is in the bullet one, would be a huge help. It's got to be a common issue I'd think.

    I've read the posts I could find on this topic and have had no luck with implementing them successfully... any thoughts on the least processor intense route to accomplish this golf ball with physics bouncing off certain sprites would be awesome!

    Thanks!

    *Update*

    I saw in this post: where jayderyu mentions the importance of not crossing the streams with physics and platformer! Is this the consensus of the elders here? Either have a platformer, OR a physics-based game, but NOT both in one game...

    *Update 2*

    Would using R0J0hound 's chipmunk physics behavior play nice with the platformer behavior?

  • Yeah, try not to mix Physics with other behaviors like Platform, Bullet, 8-Direction etc. You also should only move Physics objects using Physics actions (apply force, impulse, velocity etc.), don't just change their position or angle directly.

    All these things are not strictly forbidden, but if you mix physics and non-physics, the object may behave in unexpected way, interact with other objects incorrectly etc.

    That being said, there is an example of physics platformer game on youtube. Nobody knows how it's done, maybe it's a clever mix of both behaviors, or the author made his own platform engine with physics. We discussed it here:

    EDIT: All of the above applies to Chipmunk too.

  • Hey, thanks Didn't know the practice of not mixing engines. I have the physics in place for the golf ball "arc" including some aiming dots like angry birds. I'm not too confident in my transcribing that physics math to bullets etc.

  • If you use Physics only for gravity and bouncing off solids, you can do the same with Bullet.

    You can mix Physics with other behaviors as long as they are not both enabled at the same time.

    Say, on mouse click you disable Physics and enable Drag&Drop. On mouse release you disable Drag&Drop and re-enable Physics.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, yes. The physics is most important to the golf aspect. I'll see if I can get away with the enable/disable method.

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