0
votes

In my Corona SDK game I would like an item to drop from the sky and bounce up and down a few times before settling, at a randomly designated point on the screen. Say I'll drop an item at X=500 and Y=0. I then designate a drop-off point at Y=700, where the item will drop all the way til Y=700, bounce back up, then down, and after a few times (depending on bounciness), settle down and stay there.

This game is 2.5D, so having a static physics ground at the bottom would not work.

To do this, I came up with two options, neither which worked well:

Make a temporary invisible, 2x1 physics platform at the point where I would want the item to hit and bounce back up and down. This platform is created the moment I drop the item, and deleted when the item has settled down (fell asleep).

Inject force or change the linear velocity when the item passes a certain point.

However, because my gravity has been set to 40 (normal gravity of 9.8 was too floaty), the item will literally vibrate once it has stopped bouncing at the platform, and oscillate between velocities of 20 to -40 (varies) and not go to sleep.

The Injecting force method has also caused weird results, because the code checks the velocites per enterFrame event, so the results are not consistent.

1

1 Answers

1
votes

I think the invisible bar is what makes the most sense. I would consider lowering the gravity back to something closer to normal and play with the bounce and density to get the bouncy that you want.