Revision 375
scoreboard logic for zombies finalized
zombies.c | ||
---|---|---|
14 | 14 |
|
15 | 15 |
#define ZOMBIES_NUM 5 |
16 | 16 |
#define ZOMBIE_HEALTH_FACTOR 1.1 |
17 |
int (zombies)(void){
|
|
17 |
int (zombies)(highscores_t *zombies_highscore){
|
|
18 | 18 |
|
19 | 19 |
int r; |
20 | 20 |
|
... | ... | |
43 | 43 |
uint64_t int_vector = 0; |
44 | 44 |
int good = true; |
45 | 45 |
int dead = false; |
46 |
/// Kills |
|
47 |
int kills = -ZOMBIES_NUM; |
|
48 |
text_t *text_kills = text_ctor(font_get_default(), "Kills: 0"); |
|
49 |
text_set_color(text_kills, TEXT_COLOR); |
|
50 |
text_set_pos(text_kills, 200, 0); |
|
46 | 51 |
|
47 | 52 |
int health = 50; |
48 | 53 |
|
... | ... | |
86 | 91 |
health *= ZOMBIE_HEALTH_FACTOR; |
87 | 92 |
get_random_spawn(map1, zombie, shooter_list); |
88 | 93 |
list_push_back(shooter_list, zombie); |
94 |
kills++; |
|
95 |
char buffer[20]; |
|
96 |
sprintf(buffer, "Kills: %d", kills); |
|
97 |
text_set_string(text_kills, buffer); |
|
89 | 98 |
} |
90 | 99 |
|
91 | 100 |
graph_clear_screen(); |
92 | 101 |
map_draw (map1); |
93 | 102 |
bullet_draw_list(bullet_list); |
94 | 103 |
gunner_draw_list(shooter_list); |
95 |
|
|
96 | 104 |
text_draw(in_game_timer->text); |
105 |
text_draw(text_kills); |
|
97 | 106 |
|
98 | 107 |
sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y()); |
99 | 108 |
sprite_draw(sp_crosshair); |
... | ... | |
135 | 144 |
} |
136 | 145 |
if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n"); |
137 | 146 |
|
138 |
if(dead){ |
|
139 |
printf("YOU DIED\n"); |
|
140 |
} |
|
147 |
check_new_score(zombies_highscore, kills, in_game_timer->time); |
|
141 | 148 |
|
149 |
text_dtor(text_kills); |
|
150 |
|
|
142 | 151 |
text_timer_dtor(in_game_timer); in_game_timer = NULL; |
143 | 152 |
|
144 | 153 |
return SUCCESS; |
145 | 154 |
} |
155 |
|
|
156 |
void (zombies_ranking)(highscores_t *zombies_highscore) { |
|
157 |
|
|
158 |
} |
Also available in: Unified diff