aboutsummaryrefslogtreecommitdiff
path: root/physics.c
diff options
context:
space:
mode:
Diffstat (limited to 'physics.c')
-rw-r--r--physics.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/physics.c b/physics.c
index 945ff8c..a1edf54 100644
--- a/physics.c
+++ b/physics.c
@@ -18,6 +18,25 @@ accel(GameState *s, double)
return Vec2(0, -k*s->p.y - b*s->v.y);
}
+/*
+ * XXX: remember to take thrust into account, based on user input.
+ */
+static Point2
+accelship(Universe *u, Ship *s, double)
+{
+ double g, d;
+
+ d = vec2len(subpt2(u->star.p, s->p));
+ g = G*u->star.mass/(d*d);
+ return mulpt2(normvec2(subpt2(u->star.p, s->p)), g);
+}
+
+static Point2
+accelbullet(Universe *, Bullet *, double)
+{
+ return Vec2(0,0);
+}
+
static Derivative
eval(GameState *s0, double t, double Δt, Derivative *d)
{