Re: A85: Pinball Routine
[Prev][Next][Index][Thread]
Re: A85: Pinball Routine
82nd Deer wrote:
>
> If someone had all of those, there'd already be a Pinball game... That's
> practically 90% of the work. To my knowledge there isn't anything like
> that out there, gonna have to make it yourself.
Not true. Ballistics routines are simple. When I was programming for TI-BASIC
(don't laugh), I had made ballistic games, and breakout games. Combining the
algorithms would give you a pinball game. I don't have the BASIC source
anymore, but I vaguely remember the routines.
Breakout routine:
You need two variables, Xspeed and YSpeed. Each time the ball hits a
horizontal bar, negate the YSpeed. Each time the ball hits a vertical bar
negate the XSpeed.
There should be a main loop; Each loop check for collisions, then add the
XSpeed to the Xcoordinate, ditto for Y. Notice that X and Y should ALWAYS be
1,0, or -1
Ballistic (Gravity) routine:
Same variables. Also have an upwards momentum counter. Each loop, if
momentum!=0 and YSpeed>0 increment it, and decrement momentum. Otherwise,
decrement YSpeed. X should always be 1,0, or -1. Each loop, add Xspeed to
the X coord, ditto for the Y's.
Change the routines around to fit your game. Of course, it is harder to do it
in assembly, but more importantly MUCH FASTER.
--
Terry Peng
email- tpeng@geocities.com
web- http://www.geocities.com/SiliconValley/Bay/5104/index.html
This site always has the latest versions of my software.
Follow-Ups:
References: