Changeset 60
- Timestamp:
- Dec 23, 2002, 2:46:27 PM (18 years ago)
- Location:
- ttyvaders/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ttyvaders/trunk/src/aliens.c
r42 r60 4 4 * All Rights Reserved 5 5 * 6 * $Id: aliens.c,v 1. 7 2002/12/22 22:17:41sam Exp $6 * $Id: aliens.c,v 1.8 2002/12/23 13:46:27 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 25 25 #include "common.h" 26 26 27 static void draw_alien_ poolp( game *g, int x, int y, int frame );28 static void draw_alien_b ool( game *g, int x, int y, int frame );29 static void draw_alien_b rah( game *g, int x, int y, int frame );27 static void draw_alien_foo( game *g, int x, int y, int frame ); 28 static void draw_alien_bar( game *g, int x, int y, int frame ); 29 static void draw_alien_baz( game *g, int x, int y, int frame ); 30 30 31 31 void init_aliens( game *g, aliens *al ) … … 47 47 switch( al->type[i] ) 48 48 { 49 case ALIEN_ BRAH:50 draw_alien_ brah( g, al->x[i], al->y[i], al->img[i] % 8 );51 break; 52 case ALIEN_ POOLP:53 draw_alien_ poolp( g, al->x[i], al->y[i], al->img[i] % 2 );54 break; 55 case ALIEN_B OOL:56 draw_alien_b ool( g, al->x[i], al->y[i], al->img[i] % 6 );49 case ALIEN_FOO: 50 draw_alien_foo( g, al->x[i], al->y[i], al->img[i] % 8 ); 51 break; 52 case ALIEN_BAR: 53 draw_alien_bar( g, al->x[i], al->y[i], al->img[i] % 2 ); 54 break; 55 case ALIEN_BAZ: 56 draw_alien_baz( g, al->x[i], al->y[i], al->img[i] % 6 ); 57 57 break; 58 58 case ALIEN_NONE: … … 79 79 switch( al->type[i] ) 80 80 { 81 case ALIEN_ POOLP:82 case ALIEN_B OOL:83 case ALIEN_B RAH:81 case ALIEN_FOO: 82 case ALIEN_BAR: 83 case ALIEN_BAZ: 84 84 al->x[i] = ((al->x[i] + 5) % (g->w + 3)) - 3; 85 85 al->y[i] = al->y[i] + (rand() % 8) / 7 - (rand() % 8) / 7; … … 111 111 switch( al->type[i] ) 112 112 { 113 case ALIEN_ POOLP:113 case ALIEN_FOO: 114 114 al->life[i] = 3; 115 115 break; 116 case ALIEN_B OOL:116 case ALIEN_BAR: 117 117 al->life[i] = 3; 118 118 break; 119 case ALIEN_B RAH:119 case ALIEN_BAZ: 120 120 al->life[i] = 3; 121 121 break; … … 129 129 } 130 130 131 static void draw_alien_ poolp( game *g, int x, int y, int frame )131 static void draw_alien_bar( game *g, int x, int y, int frame ) 132 132 { 133 133 switch( frame ) … … 162 162 } 163 163 164 static void draw_alien_b ool( game *g, int x, int y, int frame )164 static void draw_alien_baz( game *g, int x, int y, int frame ) 165 165 { 166 166 gfx_color( GREEN ); … … 200 200 } 201 201 202 static void draw_alien_ brah( game *g, int x, int y, int frame )202 static void draw_alien_foo( game *g, int x, int y, int frame ) 203 203 { 204 204 gfx_color( YELLOW ); -
ttyvaders/trunk/src/collide.c
r50 r60 4 4 * All Rights Reserved 5 5 * 6 * $Id: collide.c,v 1. 8 2002/12/23 09:28:37 sam Exp $6 * $Id: collide.c,v 1.9 2002/12/23 13:46:27 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 262 262 void collide_player_tunnel( game *g, player *p, tunnel *t, explosions *ex ) 263 263 { 264 if( p->dead ) 265 { 266 return; 267 } 268 264 269 if( p->x <= t->left[p->y] ) 265 270 { 266 271 p->x += 2; 267 272 add_explosion( g, ex, p->x+1, p->y-2, 0, 0, EXPLOSION_SMALL ); 273 p->life -= 50; 268 274 } 269 275 else if( p->x + 5 >= t->right[p->y] ) … … 271 277 p->x -= 2; 272 278 add_explosion( g, ex, p->x+4, p->y-2, 0, 0, EXPLOSION_SMALL ); 279 p->life -= 50; 273 280 } 274 281 } -
ttyvaders/trunk/src/common.h
r58 r60 4 4 * All Rights Reserved 5 5 * 6 * $Id: common.h,v 1.1 2 2002/12/23 13:13:04sam Exp $6 * $Id: common.h,v 1.13 2002/12/23 13:46:27 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 20 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 21 */ 22 23 #define MAX_LIFE 1000 22 24 23 25 #define STARS 50 … … 105 107 int vx, vy; 106 108 int weapon, nuke; 109 int life, dead; 107 110 108 111 } player; … … 110 113 typedef struct 111 114 { 112 enum { ALIEN_NONE, ALIEN_ POOLP, ALIEN_BOOL, ALIEN_BRAH} type[ALIENS];115 enum { ALIEN_NONE, ALIEN_FOO, ALIEN_BAR, ALIEN_BAZ } type[ALIENS]; 113 116 int x[ALIENS]; 114 117 int y[ALIENS]; -
ttyvaders/trunk/src/main.c
r58 r60 4 4 * All Rights Reserved 5 5 * 6 * $Id: main.c,v 1.1 3 2002/12/23 13:13:04sam Exp $6 * $Id: main.c,v 1.14 2002/12/23 13:46:27 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 169 169 if( GET_RAND(0,10) == 0 ) 170 170 { 171 int list[3] = { ALIEN_ POOLP, ALIEN_BOOL, ALIEN_BRAH};171 int list[3] = { ALIEN_FOO, ALIEN_BAR, ALIEN_BAZ }; 172 172 173 173 add_alien( g, g->al, 0, rand() % g->h / 2, list[GET_RAND(0,3)] ); -
ttyvaders/trunk/src/player.c
r58 r60 4 4 * All Rights Reserved 5 5 * 6 * $Id: player.c,v 1. 5 2002/12/23 13:13:04sam Exp $6 * $Id: player.c,v 1.6 2002/12/23 13:46:27 sam Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 36 36 p->weapon = 0; 37 37 p->nuke = 0; 38 p->life = MAX_LIFE; 38 39 39 40 return p; … … 47 48 void draw_player( game *g, player *p ) 48 49 { 50 if( p->dead ) 51 { 52 return; 53 } 54 49 55 gfx_goto( p->x + 2, p->y - 2 ); 50 56 gfx_color( GREEN ); … … 63 69 void update_player( game *g, player *p ) 64 70 { 71 if( p->dead ) 72 { 73 return; 74 } 75 76 if( p->life <= 0 ) 77 { 78 add_explosion( g, g->ex, p->x, p->y, 0, 0, EXPLOSION_SMALL ); 79 p->dead = 1; 80 return; 81 } 82 83 /* Update weapon stats */ 65 84 if( p->weapon ) 66 85 { … … 73 92 } 74 93 94 /* Update life */ 95 if( p->life < MAX_LIFE ) 96 { 97 p->life++; 98 } 99 100 /* Update coords */ 75 101 p->x += p->vx; 76 102
Note: See TracChangeset
for help on using the changeset viewer.