www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/03/18:10:48

From: SerDevian <scriven AT CS DOT ColoState DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bouncing
Date: Mon, 03 Feb 1997 12:58:59 -0700
Organization: XYZZ Software Co.
Lines: 23
Message-ID: <32F64383.446B@CS.ColoState.edu>
References: <32F44C1B DOT 2E7B AT dmv DOT com>
NNTP-Posting-Host: dali.vis.colostate.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Pyro Technic wrote:
> How would I get a ball to bounce realisticly. The constant velocity and
> four directions I have noe just just. Do I need an algorithim,
> logirithm, or some other thing a newbie like myself has never heard of.

With gravity, or without?  What does it bounce off of?

I'll assume you want a round ball bouncing against a flat surface,
taking gravity into account.

One simple way is to keep track of the ball's position and velocity. 
Just add an accelation constant to the velocity each frame and negate
the ball's velocity when it hits the ground.  Add the velocity to the
position each frame, and draw the ball; it should move parabolically.

I've done this, and it works fine.  It also takes virtually no processor
time...


-- Yamaha / XYZZ          "May farce the with be you."
mailto:scriven AT CS DOT ColoState DOT edu          
mailto:scriven AT VIS DOT ColoState DOT edu
http://www.vis.colostate.edu/~scriven/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019