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:
511783c
)
improved ship placement/velocity (initial and after a death).
author
Joshua Grams
<josh@qualdan.com>
Fri, 29 Apr 2005 00:17:52 +0000
(
00:17
+0000)
committer
Joshua Grams
<josh@qualdan.com>
Fri, 29 Apr 2005 00:17:52 +0000
(
00:17
+0000)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index
3fbe7a6
..
ecdc4e6
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-668,7
+668,6
@@
gameloop() {
// Create a new ship and start all over again
state = GAMEPLAY;
play_tune(1);
// Create a new ship and start all over again
state = GAMEPLAY;
play_tune(1);
- shipx -= 50;
break;
case GAME_OVER:
state = HIGH_SCORE_ENTRY;
break;
case GAME_OVER:
state = HIGH_SCORE_ENTRY;
@@
-725,27
+724,29
@@
gameloop() {
shipdy *= pow((double)0.9,(double)gamerate);
}
shipdy *= pow((double)0.9,(double)gamerate);
}
+ // INERTIA
+ shipx += shipdx*gamerate;
+ shipy += shipdy*gamerate;
+
// SCROLLING
// SCROLLING
- tmp = shipy - (YSIZE / 2);
- tmp += shipdy * 25;
- tmp /= -25;
- tmp = ((screendy * (gamerate - 12)) + (tmp * gamerate)) / 12;
- screendy = -tmp;
if(state == GAMEPLAY) {
if(state == GAMEPLAY) {
+ tmp = shipy - (YSIZE / 2);
+ tmp += shipdy * 25;
+ tmp /= -25;
+ tmp = ((screendy * (gamerate - 12)) + (tmp * gamerate)) / 12;
+ screendy = -tmp;
tmp = shipx - (XSIZE / 2);
tmp += shipdx * 25;
tmp /= -25;
tmp = ((screendx * (gamerate - 12)) + (tmp * gamerate)) / 12;
screendx = -tmp;
tmp = shipx - (XSIZE / 2);
tmp += shipdx * 25;
tmp /= -25;
tmp = ((screendx * (gamerate - 12)) + (tmp * gamerate)) / 12;
screendx = -tmp;
- } else screendx = 7.5;
+ } else if(state != DEAD_PAUSE) screendx = 7.5;
xscroll = screendx * gamerate;
yscroll = screendy * gamerate;
xscroll = screendx * gamerate;
yscroll = screendy * gamerate;
+ shipx -= xscroll;
+ shipy -= yscroll;
- // INERTIA
- shipx += shipdx*gamerate - xscroll;
- shipy += shipdy*gamerate - yscroll;
-
move_rocks();
move_rocks();
@@
-759,7
+760,6
@@
gameloop() {
// BOUNCE Y
if(shipy<0 || shipy>YSIZE-surf_ship->h) {
// BOUNCE from top and bottom wall
// BOUNCE Y
if(shipy<0 || shipy>YSIZE-surf_ship->h) {
// BOUNCE from top and bottom wall
- printf("bouncing top/bottom.\n");
shipy -= shipdy;
shipdy *= -0.99;
}
shipy -= shipdy;
shipdy *= -0.99;
}
@@
-769,9
+769,9
@@
gameloop() {
// Play the explosion sound
play_sound(0);
make_bang_dots(shipx,shipy,shipdx,shipdy,surf_ship,30);
// Play the explosion sound
play_sound(0);
make_bang_dots(shipx,shipy,shipdx,shipdy,surf_ship,30);
- shipdx = 0;
- shipdy = 0;
+ shipdx *= 0.5; shipdy *= 0.5;
if(--nships <= 0) {
if(--nships <= 0) {
+ shipdx = 0; shipdy = 0;
gameover = 1;
state = GAME_OVER;
state_timeout = 200.0;
gameover = 1;
state = GAME_OVER;
state_timeout = 200.0;
@@
-798,10
+798,8
@@
gameloop() {
play_tune(1);
gameover = 0;
play_tune(1);
gameover = 0;
- shipx = XSIZE/2;
- shipy = YSIZE/2;
- shipdx = 0;
- shipdy = 0;
+ shipx = XSIZE/2; shipy = YSIZE/2;
+ shipdx = screendx; shipdy = screendy;
}
maneuver = 0;
}
maneuver = 0;