Programming an Arch

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
Jeff-20
Denial Founder
Posts: 5761
Joined: Wed Dec 31, 1969 6:00 pm

Programming an Arch

Post by Jeff-20 »

I want to create a program to simulate an arch a la Artillery Duel. This could useful for jumping or side-view projectile motions. I know this is probably a simple math question, but I am open to suggestions. I want to figure out a way to do it with speed.
High Scores, Links, and Jeff's Basic Games page.
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

I'd guess something like this.
Doesn't need a whole lot of CPU.

Code: Select all

10 g=0.05
20 vx=3;vy=3;x=0;y=0
30 ? "bang"
40 x=x+vx;y=y+vy;vy=vy-g;
50 [plot bullet at x,y]
60 if y>0 then goto 40
70 ? "boom"

IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

Probably "vy=vy+g" rather than "vy=vy-g". I'm assuming +y is "down" rather than "up".

Oh, and to "jump", you need to start with a negative vy, like "vy=-3".

BTW, the mathematical term for this curve is a "parabola".
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

IsaacKuo wrote:Probably "vy=vy+g" rather than "vy=vy-g". I'm assuming +y is "down" rather than "up".

Oh, and to "jump", you need to start with a negative vy, like "vy=-3".

BTW, the mathematical term for this curve is a "parabola".
Nope +y is up, if you added g then it would shoot off into space.
Depends on your coordinate system.
IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

My point is that for his purposes, +y is probably going to be down (with 0 at the top of the screen).
Post Reply