JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added a little prediction and monentum to the scrolling
authorJason Woofenden <jason@jasonwoof.com>
Mon, 13 Dec 2004 19:55:41 +0000 (19:55 +0000)
committerJason Woofenden <jason@jasonwoof.com>
Mon, 13 Dec 2004 19:55:41 +0000 (19:55 +0000)
main.c

diff --git a/main.c b/main.c
index 489c352..03d173c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -134,6 +134,7 @@ float xvel,yvel;    // Change in X position per tick.
 float rockrate,rockspeed;
 float movementrate;
 float yscroll;
+float scrollvel;
 
 int nships,score,initticks,ticks_since_last, last_ticks;
 int gameover;
@@ -1093,7 +1094,10 @@ int gameloop() {
 
                        // SCROLLING
                        yscroll = yship - (YSIZE / 2);
-                       yscroll /= -15;
+                       yscroll += yvel * 25;
+                       yscroll /= -25;
+                       yscroll = ((scrollvel * (12 - movementrate)) + (yscroll * movementrate)) / 12;
+                       scrollvel = yscroll;
                        yscroll = yscroll*movementrate;
                        yship += yscroll;