Re: LZ: Programming question


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

Re: LZ: Programming question



On Fri, 4 Oct 1996, A.K.A. TheWiz wrote:


> > My guess would be to take the angle of the line and use it as a slope to
> > find where the arc strikes the wall ( and this idea is looking good Frank ).
> <SNIP>
>   Yeah, that's probably a lot faster than the routine I suggested earlier.
>
>
>                      /***********************************
>                      *           Daniel Knapp           *
>                      *       FeatherWate Software       *
>                      *     email: dankna@bergen.org     *
>                      *                                  *
>                      *      Whose account this is,      *
>                      *         I think I know.          *
>                      * The sysop is in <SNIP> :)


I tried this in TIBASIC, and had a problem; with the algorithm I was using
to derive slopes from degree angles, I got exponential results as I got
higher; 90 degrees was close to 45, 180 close to 90, and so on.  I am
rewriting it now.  My algebra 2, trig, and precalculus teachers have been
working with me also.


In the meantime, the sine/cosine system might be fast enough to be a
viable solution if we used a lookup table instead of live calculations.
Due to the small size of the screen, we really only need left/right to do
about 5 or 6 degree increments; if we cut it off at 20 degrees from
horizontal in 5 degree increments, there would only be 14 or so values.
Just mirrored for the other side of the screen.


I have also considered just keeping premade coordinates for each angle in
a lookup table ( bouncing to the top of the screen ) and using
Brenhasam's line algorithm to project the line until it hits the bubble or
top wall.


In retrospect, this program might warrant grayscale; 6 colors of bubbles
and colors 7 and 8 for the dotted beam and/or special-weapon-style bonus
bubbles, or the gun and background perhaps.


Ryan Myers
rmyers@teleport.com
http://www.teleport.com/~rmyers/
-- "One useless man is a disgrace.  Two useless men are a burden to
-- society.  Three or more useless men means Congress is in session."


References: