Archived

This topic is now archived and is closed to further replies.

Projectile simualtion on a TI-83

This topic is 5573 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

On my TI-83 Plus graphing calculator, I am working on a remake of the classic game Gorrilas, in which two gorrilas stand on top of skyscrapers and you must guess the correct angle and speed to release the banana so it will fly and hit the other gorilla. This is posted in the Math & Physics section, so obviously I am stuck on getting the right trajectory. What info I have to work with is the initial angle, and the initial speed, along with the projectiles X and Y screen coordinates. I can get the projectile to release at the correct angle, but I can''t incorperate a parabola into it. How would I get the pixel to fly in a parabola, whos arc depends on speed and inital angle? Remember, I''m doing this in calcuator-basic, so I don''t think I can use vector math or stuff like that. Thanks!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
once upon a time, many years ago, you could find qbasic versions of all these games...being qbasic, you could read the source...

[so]

translating to calculator basic from qbasic is not hard/

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
once upon a time, many years ago, you could find qbasic versions of all these games...being qbasic, you could read the source...

[so]

translating to calculator basic from qbasic is not hard/




Don''t disregard this answer by Anon. Seriously, it''s true. And it''s the answer that will help you the most if you follow through on it. Search for Gorrilas.bas or something on Google. That''s a start. Read the source, go from there.

Share this post


Link to post
Share on other sites
I think its something like:

initial X-Vel = Speed * cos(angle)
initial Y-Vel = Speed * sin(angle)

Every frame, you slightly modify the value of y to simulate gravity, and modify the x value to simulate wind (if any). You then add/subtract the X-Vel and Y-Vel from the pixel's coords.

Edit: That is, slightly modify the X and Y velocity to simulate wind and gravity

[edited by - glassJAw on September 10, 2002 10:28:19 PM]

Share this post


Link to post
Share on other sites
That's a start, but you need the full formula:


y(t) = -1/2gt2 + Vy*t + S


t = time from start [0 - ???],
g = gravitational constant (9.8 m/s2 or 16 ft/s2, but we're working in pixels so you might need to tweak that)
Vy = Initial vertical speed (Speed * sin(angle))
S = Initial height off ground

The x position is simply (Vx*t + Ix), where Ix is the initial X coordinate and Vx is (Speed * cos(angle)).

This is all basic physics and trajectories, so if you Google it you'd get countless references.

Oh yes, and the formula I provided assumes the screen coordinate system is the same as a regular 2D cartesian system, but it really isn't, as -y is actually up in terms of the screen. So just invert anything that has to do with Y, i.e the 1/2 and Vy, etc.

[edited by - Zipster on September 10, 2002 10:36:59 PM]

[edited by - Zipster on September 12, 2002 2:36:02 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
dude, have you any idea how slow and skippy that game would be?
first try making a two frame animation; it don''t work. You need to learn TI-83 assembly. Basic on the calc is only for graphing and for "formulae programs" not "Mega Man"!!!!!

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
dude, have you any idea how slow and skippy that game would be?
first try making a two frame animation; it don''t work. You need to learn TI-83 assembly. Basic on the calc is only for graphing and for "formulae programs" not "Mega Man"!!!!!


Except that it isn''t a realtime game, so choppiness doesn''t matter too much. It can go as slow or as fast as the max framerate.

Share this post


Link to post
Share on other sites
Yeah, I know about the speed thing... I made a pong game on there, and it flat-out sucked because it went ridiculously slow, lol. But this game can go slower/skip frames because the gameplay isn''t speed based. I made a mini-golf game using TI-basic and it rocked , but got erased.

Share this post


Link to post
Share on other sites
You might be able to accelerate it by generating a parabola, finding its bounds at x, and graphing the result. To graph a function with boundaries, Y1=f(x)(ab)

Or something like that. Don''t do what the graphing calculator does, with TI-Basic; use the built-in function instead. Then, you might be able to trace the function and find where it hit, or just do the function once to see where it hit.

Share this post


Link to post
Share on other sites
Well, I thought I might enlighten you. All you have to do is get the x and y velocities based on speed*cos and speed*sin, then all you gotta do is decrease the y velocity every frame by a constant. Just play around until you find one that works well. Then each frame x+=x_vel and y+=y_vel. Simple as that...

~WarDekar

Share this post


Link to post
Share on other sites