Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
vor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fac9f09
)
added a little prediction and monentum to the scrolling
author
Jason Woofenden
<jason@jasonwoof.com>
Mon, 13 Dec 2004 19:55:41 +0000
(19:55 +0000)
committer
Jason Woofenden
<jason@jasonwoof.com>
Mon, 13 Dec 2004 19:55:41 +0000
(19:55 +0000)
main.c
patch
|
blob
|
history
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 rockrate,rockspeed;
float movementrate;
float yscroll;
+float scrollvel;
int nships,score,initticks,ticks_since_last, last_ticks;
int gameover;
int nships,score,initticks,ticks_since_last, last_ticks;
int gameover;
@@
-1093,7
+1094,10
@@
int gameloop() {
// SCROLLING
yscroll = yship - (YSIZE / 2);
// 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;
yscroll = yscroll*movementrate;
yship += yscroll;