Re: A85: Pinball Routine


[Prev][Next][Index][Thread]

Re: A85: Pinball Routine



Brandon Turok wrote:
> 
> I'm writing a pinball game for Usgard, but I have one problem:  I
> don't
> have a realistic pinball routine.  If anyone has one that meets the
> following specs, I'd be grateful.

Well, I don't have any routines, but here are a few suggestions on
making some:

> *The ball must have a sense of gravity going towards the bottom of the
> screen.

Gravity is done by acceleration.  Have the ball's downward speed, and
add a constant amount to it every cycle of the game.  Just mess with the
value to get a realistic gravity.

> *The ball must bounce off the walls, bumpers, etc. at realistic
> angles.

Angle of incidence = angle of reflection.  Basic physics.  To simplify
computing, make a limited number of angles, say 16 angle positions with
22.5 degree spaces in between.  With that, you get 

> *I must be able to give the ball some upward momentum (from the
> starter, the flippers, and the bumpers)

Subtract from the downward speed.
 
> Any help would be greatly appreciated.
> --
> -Brandon Turok
> -windowswiz@ibm.net
> -http://www.geocities.com/SiliconValley/Bay/8790/

Or just scrap what I just said 'cause I just had another idea.  Have two
speeds, a horizontal speed and a vertical speed.  The gravity subtracts
a constant amount from the vertical speed each game cycle.  For each
wall the ball hits, have a vertical and horizontal variable that
determines how it changes the ball's vertical and horizontal speed. 
Like a vertical wall would reverse horizontal speed and not change
vertical speed.  A 45 degree slant would swap the ball's horizontal and
vertical speeds.  For bumpers and flippers, they could also have another
value that adds to the ball's speed.

If that sounds too complicated, maybe someone else could simplify it, or
have another, better way to make a pinball engine.

-- 
Jonathan Anderson
sarlok@geocities.com

"I can't be wrong - my modem is error correcting."


References: