I started on the trigonometry page. What do you guys think?
Date: 03 Feb 2013 16:52
Number of posts: 8
RSS: New posts
Don't projectiles follow parabolic paths though? you might want to use a different example of using trig in a program —maybe an analog clock or a spiral wheel or something?
Well, here in Earth with gravity, projectiles follow elliptical paths. That's difficult to emulate, though - even assuming that the Earth is a perfect sphere with constant mass throughout, I don't know how many meters 1 point represents. I suppose I could just assume that it's a flat surface and subtract for gravity…
You're confusing me, so…the trig example is fine how it is then, hehehe
Naw, it was a good point. I added in some code for gravity. It follows a parabolic path now - I'm just constantly lowering change in Y. It's a second degree constant change, which makes a quadratic, and a parabola is a quadratic.
What I was saying was that it would be way too difficult to simulate how an actual projectile moves, with factors like Earth being a sphere that would change it from parabolic to elliptical.
I was originally going to do something like drawing a circle or making a clock, but a projectile is more exciting.
What I like to do for gravity is something like this:
; B and C are (Y,X) DelVar BDelVar C Delvar W1→V ;V=initial x velocity, W=initial Y velocity Repeat getKey=45 B+W→B C+V→C If C>94 or C<0 Then C-V→C -V→V End If B>62 or B<0 ;if X gravity is 0, you don't need the last part Then B-W→B -W→W End W+.1→W ;.1 for y-gravity V+0→V ;0 for x-gravity Pxl-Change(int(B),int(C End
Now you can use variables in place of the gravity and you can control the gravity with arrows :) To implement it in your projectile code, you just use power*sin(angle) for the initial x velocity and power*cos(angle) for the initial y velocity (hopefully I didn't switch those around). You can also dampen the bounciness with constants such as -.6W→W and -.6V→V. I don't believe that is entirely accurate, but it looks decent.
47%? Take a look and try to imagine how cool 100% will be. This has won zContest 2011 and made news on TICalc. This compromise between Assembly and BASIC parses like BASIC and is fast like assembly. Grammer 2
Nice. The bouncing is a nice touch, too. I just let the projectile go off screen, which forced me to use pt commands, darn point commands…
I'm too lazy to integrate your code with trig, so you should do it.