1. Re: bullet code (was ICONS - dead horse)
Your code looks a bit misled and rats nest-like. Unfortunately you are trying
to do something iteratively (read: the hard way) when it can easily be done
algebraicly.
If you want the position of the bullet with respect to time then try
----begin code----
constant vx=1,vy=1 --initial velocity, x and y components
constant dt=.01 --time increment
constant g=9.80665 --gravitational acceleration
constant xmax=500, ymax=950
atom x,y,t
x=0 y=0 t=0
while x<xmax and y<ymax do --this 'and' might need to be 'or'
x=vx*t
y=vy*t - .5*g*t*t --t*t is simpler than power(t,2)
plot(x,y) --replace with your plotting function
t += dt --increment time
end while
----end code------
alternatively, if you only want the path of the bullet and not a real time
display of it flying then you can calculate y with respect to x
----begin code----
constant vx=1,vy=1 --initial velocity, x and y components
constant k=vx*vy --I am a speed freak
constant dx=1 --x increment
constant g=9.80665 --gravitational acceleration
constant xmax=500, ymax=950
atom y
for x=1 to xmax by dx do
y=k/x - .5*g*power(k/x,2) --much as I hate power() I use it
if y>ymax then exit end if --bullet has left universe
plot(x,y) --replace with your plot function
end for
----end code------
Have fun !
--
Daniel Johnson Engineer, smartypants and clown
Jesus College, Cambridge all at a very reasonable price
dpj22 at cam.ac.uk
zeus.jesus.cam.ac.uk/~dpj22 talk dpj22 at jewish.jesus.cam.ac.uk