TI Pinball 0.11 for all 68k calcs!
Posted by Morgan on 21 June 2003, 09:18 GMT
Jude Nelson has released TI Pinball 0.11, the first assembly Pinball game for 68k calcs. Jude has been producing a number of notable programs including Spazian 0.25, which came out last month for all 68k calcs. This latest game includes all features imaginable. They are, "...fourlevel grayscale, six modes of gravity, multiple tables, and pretty much everything a computerized pinball machine should support." As well as being more of an original game, and showing the potential of 68k calcs, this type of program makes my job worth doing.



The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.


Re: TI Pinball 0.11 for all 68k calcs!

KermMartian
(Web Page)

sweeet!!! Wish that there was something like this for the z80 calcs. Too hard in BASIC, though.


21 June 2003, 17:25 GMT


























Re: Re: Re: Re: Re: Re: Re: Re: Re: TI Pinball 0.11 for all 68k calcs!

JcN

Actually, gravity is so simple to implement, it is usually overlooked. I was able to get gravity (including unstable gravity) with only 6 variables, and not a single trig function!
All you need are:
>>the ball's x and y coordinates (I call them ballx and bally)
>>the ball's x and y vectors (I call them ballmovex and ballmovey; their values are added to ballx and bally to make it move). These are implemented exactly like they are in simple bouncingball type programs and in breakout games.
>>the x and y magnitude shift variables (I call them moveshiftx and moveshifty). You only need moveshifty for normal gravity. It is added to ballmovey, and does not change unless you want to change the strength of the gravity.
In the program, the moveshifty variable is set to 0.25, which, when added to the ballmovey vector, increases its value. Because moveshifty is added to ballmovey, the yvalue for the ball constantly increases. This may seem odd if you try to plot the results, but remember: The greater the y variable in TIGCC, the lower the corrosponding object is on the screen. This means that I slowly increase the ball's y trajectory downward. When a ball hits an object, it's ballmovey vector is set to some negative number, causing it to move upward.
As you can see from this method, bally will decrease at a slower and slower rate, until it stops, and increases again. This is reflected in the ball as it moves upwards at a slower and slower rate, until falling back down faster.
That's gravity in a nutshell, but I also created a limit as to how big ballmovey could get before it stopped increasing (to prevent the ball from accelerating too fast for the user to handle), and I also slowly decrease the absolute value of the ballmovex variable to make the ball's movements seem move parabolic than hyperbolic.


22 June 2003, 07:28 GMT
































Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: TI Pinball 0.11 for all 68k calcs!

JcN

The unstable gravity is based on mofifying the x velocity. The unstable gravity simply causes the ball to be repelled from the sides of the table.
I know that the ball does not quite always collide with the flipper at times...but the alternative is the ball moving though the flipper. I used a modified of the pointline distance formula to get the ball to effectively bounce off of angled surfaces. If m is the slope of a line, x1 and y1 are the cooridnates of the ball, and b is its yintercept, then the equation is this:
distance = abs(mx1 + y1  b)/sqrt((m)^2+1)
This comes from the original formula:
distance = abs(ax1 + by1 + c)/sqrt(a^2+b^2)
where a, b, and c are coefficients in a standard linear equation.
Because y increases as the object moves downward, I must subtract the c value instead of adding it. So the actual formula is
distance = abs(ax1 + by1  c)/sqrt(a^2+b^2)
Also because I am using a yint equation form, a = m, b = 1, and c = the yint.


23 June 2003, 01:25 GMT






































Re: ~

JcN

I see where you're going, but that wouldn't work very well because trig functions (especially in C) are pretty slow; slow enough that I would need to use a lookup table, which is an array. Also, how do you simulate gravity movement by changing it's angular trajectory? Are you saying I should use something like this? (see below)
void moveball(short *ballx, short *bally, short *angle)
{
int change;
if(*angle < 270) change = 1;
else change = 1;
*angle+=change;
foat movey=sin(*angle),movex=cos(*angle);
Sprite8(*ballx, *bally, 8, ball, LCD_MEM, SPRT_XOR);
*ballx+=movex;
*bally+=movey;
Sprite8(*ballx, *bally, 8, ball, LCD_MEM, SPRT_XOR);
}
instead of
void moveball(short *x, short *y, short *movex, short *movey, short *gravity) {
Sprite8(*x, *y, 8, ball, LCD_MEM, SPRT_XOR);
*x+=*movex;
*y+=*movey;
*y+=*gravity;
Sprite8(*x, *y, 8, ball, LCD_MEM, SPRT_XOR);
}
The first function would be pretty slow, and I don't think the gravityaltered trajectory would be very accurate. My function (second function) seems to be faster (even though that is not the whole function above). I'll try it out, though.


27 June 2003, 03:57 GMT















































Re: Re: ~

JcN

Not really...I had both Geometry and Trigonometry in the same year by the same teacher in the same period (the classes and the curriculum were accelerated). I did, however, ask my teacher how to use polar math to calculate a vector based on the radius of a circle and the angle measurement formed from the x axis (or the circle's horizontal axis) and the radius. This algrithm, however, is best used in games that require some sort of rotation (i.e. asteroid clones), not to simulate gravity. I don't see why you need to convert polar values to rectangular values, though. From the angle and the radius length, you can easily calculate a vector. The direction is computed from the center of the circle at (h,k) and the point on the circle where the radius intersects the curve (cos(angle)+h, sin(angle)+k). The magnitude equals the length of the radius.
In programming, you can get an object to move via this sort of vector by adding radius*cos(angle)to the x coordinate (x=h) and radius*sin(angle) to the y coordinate (y=k).


29 June 2003, 07:11 GMT


1 2 3 4 5 6
You can change the number of comments per page in Account Preferences.
