I am trying to do a basic version of space war(http://en.wikipedia.org/wiki/Spacewar_%28video_game%29) but I cannot figure out how to do the inertia part
that is my code : I should let the ship accelerate or slow down based on where it faces
model is the ship vx and vy are velocity of x and y direction theta are rotate degree 20 is for make it move slow
vx=model.vx+(cos (degrees model.theta))/20,
vy=model.vy+(sin (degrees model.theta))/20
but it does not seem right Can someone help me? I am horrible in physics!
0.25*f(0) + 0.25*f(0.25) + 0.25*f(0.5) + 0.25*f(0.75)
. Which is like pretending that f has the same value between 0 and 0.25, then the same value between 0.25 and 0.5, etc. So the approximation is pretending that time is discrete. Normally expressed in games as justposition += velocity; velocity *= 0.99;
or whatever that looks like in your language (admittedly possibly quite different in functional ELM, since that's a destructive state mutation, etc) - Tommy