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 (from parent 1:
cf30b5f
)
first try at blasting the rocks out of the way
author
Joshua Grams
<josh@qualdan.com>
Mon, 13 Dec 2004 20:26:08 +0000
(20:26 +0000)
committer
Joshua Grams
<josh@qualdan.com>
Mon, 13 Dec 2004 20:26:08 +0000
(20:26 +0000)
config.h
patch
|
blob
|
history
main.c
patch
|
blob
|
history
diff --git
a/config.h
b/config.h
index
63d143b
..
d8991ef
100644
(file)
--- a/
config.h
+++ b/
config.h
@@
-18,4
+18,4
@@
#define MAXSPACEDOTS 2000
#define W 100
#define M 255
#define MAXSPACEDOTS 2000
#define W 100
#define M 255
-#define START_RAD_SQ 40000 // radius^2 (pixels) which will be cleared of rocks when you die
+#define START_RAD 200 // radius^2 (pixels) which will be cleared of rocks when you die
diff --git
a/main.c
b/main.c
index
03d173c
..
71f014b
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-1002,15
+1002,8
@@
int 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);
- xship = 10;
- yship = YSIZE/2;
xvel = 3;
yvel = 0;
xvel = 3;
yvel = 0;
- for(i = 0; i<MAXROCKS; i++ ) {
- if(dist_sq(xship, yship, rock[i].x, rock[i].y) < START_RAD_SQ) {
- rock[i].active = 0;
- }
- }
break;
case GAME_OVER:
state = HIGH_SCORE_ENTRY;
break;
case GAME_OVER:
state = HIGH_SCORE_ENTRY;
@@
-1055,6
+1048,20
@@
int gameloop() {
state_timeout = 200.0;
break;
}
state_timeout = 200.0;
break;
}
+ } else {
+ if(state == DEAD_PAUSE) {
+ float blast_radius = START_RAD * state_timeout / 50.0;
+ for(i = 0; i<MAXROCKS; i++ ) {
+ float dx, dy, n;
+ dx = rock[i].x - xship;
+ dy = rock[i].y - yship;
+ n = sqrt(dx*dx + dy*dy);
+ if(n < blast_radius) {
+ rock[i].xvel += rockrate*dx/n;
+ rock[i].yvel += rockrate*dy/n;
+ }
+ }
+ }
}
if(--countdown <= 0 && (rnd()*100.0<(rockrate += 0.025))) {
}
if(--countdown <= 0 && (rnd()*100.0<(rockrate += 0.025))) {
@@
-1105,15
+1112,14
@@
int gameloop() {
for(i = 0; i<MAXROCKS; i++) if(rock[i].active) {
rock[i].x += rock[i].xvel*movementrate;
rock[i].y += rock[i].yvel*movementrate + yscroll;
for(i = 0; i<MAXROCKS; i++) if(rock[i].active) {
rock[i].x += rock[i].xvel*movementrate;
rock[i].y += rock[i].yvel*movementrate + yscroll;
- if(rock[i].y > YSIZE) {
- rock[i].y -= YSIZE;
- rock[i].y -= rock[i].image->w;
- } else if(rock[i].y < -rock[i].image->w) {
- rock[i].y += YSIZE;
- rock[i].y += rock[i].image->w;
- }
- if(rock[i].x<-32.0)
- rock[i].active = 0;
+ if(rock[i].y > YSIZE) {
+ rock[i].y -= YSIZE;
+ rock[i].y -= rock[i].image->w;
+ } else if(rock[i].y < -rock[i].image->w) {
+ rock[i].y += YSIZE;
+ rock[i].y += rock[i].image->w;
+ }
+ if(rock[i].x < -32.0) rock[i].active = 0;
}
}
@@
-1148,7
+1154,10
@@
int gameloop() {
else {
state = DEAD_PAUSE;
state_timeout = 50.0;
else {
state = DEAD_PAUSE;
state_timeout = 50.0;
-
+ xship = 10;
+ yship = YSIZE/2;
+ xvel = 0;
+ yvel = 0;
}
}
}
}