The Daily Click ::. Forums ::. Klik Coding Help ::. Ball bounce
 

Post Reply  Post Oekaki 
 

Posted By Message

z3lda



Registered
  07/06/2003
Points
  16
6th February, 2004 at 23:33:42 -

Anyone have ball bouncing code I can use? Not the bounce code that is already in MMF. I need something that can bounce off ground, wall that is somewhat real.

JC

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
7th February, 2004 at 02:30:00 -

You mean like realistic gravity-acceleration bouncing? Those are simple enough to make. Just take some stuff from a basic physics book and convert it into MMF code .

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
7th February, 2004 at 03:06:43 -

s = ut + 0.5at^2, remember. Actually, that's pretty much all the Physics I can recall from school.

 
http://www.davidn.co.nr - Games, music, living in America

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
7th February, 2004 at 03:15:24 -

Well, I meant something like...
Every 0.01
Flag 0 is on

Ball: Set Y position to Y position + Alterable value A
Set Alterable Value A to Alterable Value A + 10


Just make sure flag 0 is on when it goes down. Convert the Alterable Value A to a negative value (with a few mods for energy loss). Then use another flag for when it goes up and do the deceleration.

There, you get very easy vertical bouncing ball acceleration. And it's even realistic. You can probably do something similar for horizontal acceleration.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Shen

Possibly Insane

Registered
  14/05/2002
Points
  3497
7th February, 2004 at 04:36:41 -

Omg stop confusing the poor little guy This method isn't the best, but it's the way it works:

Every 0'00'10: Add 1 to Alt A of ball (This makes the ball gain downwards speed)
Always: Set Y position of ball to Y position of ball + Alt A of ball (This actually moves the ball)
Ball collides with horizontal background: Set Alt A of ball to Alt A of ball * -1 (This reverses the downwards speed, so it goes up)

It's a fairly buggy method, but it should work.



 
gone fishin'

z3lda



Registered
  07/06/2003
Points
  16
7th February, 2004 at 17:40:24 -

Hey,

thanks for the help, but I found the movement extension and it has it all there . I'm just too lazy to click it myself, lucky there's allot of usefull extensions.

thanks again.

John

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
7th February, 2004 at 22:57:39 -

Shen:
That's more or less what I said.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image
   

Post Reply



 



Advertisement

Worth A Click