Revision 302
working on zombies
proj.c | ||
---|---|---|
288 | 288 |
|
289 | 289 |
list_t *shooter_list = list_ctor(); |
290 | 290 |
|
291 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player); if(shooter1 == NULL) printf("Failed to get shooter1\n"); |
|
291 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
292 | 292 |
gunner_set_spawn(shooter1, 75, 75); |
293 | 293 |
gunner_set_pos(shooter1, 75, 75); |
294 | 294 |
|
295 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing, gunner_player); |
|
295 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing, gunner_player, 2);
|
|
296 | 296 |
gunner_set_spawn(shooter2, 975, 75); |
297 | 297 |
gunner_set_pos(shooter2, 775, 75); |
298 | 298 |
|
... | ... | |
343 | 343 |
|
344 | 344 |
graph_clear_screen(); |
345 | 345 |
map_draw (map1); |
346 |
bullet_draw_list(bullet_list); |
|
346 | 347 |
gunner_draw_list(shooter_list); |
347 |
bullet_draw_list(bullet_list); |
|
348 | 348 |
|
349 | 349 |
text_draw(in_game_timer->text); |
350 | 350 |
|
... | ... | |
424 | 424 |
|
425 | 425 |
list_t *shooter_list = list_ctor(); |
426 | 426 |
|
427 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player); if(shooter1 == NULL) printf("Failed to get shooter1\n"); |
|
427 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
428 | 428 |
gunner_set_spawn(shooter1, 75, 75); |
429 | 429 |
gunner_set_pos(shooter1, 75, 75); |
430 | 430 |
|
... | ... | |
444 | 444 |
int ipc_status; |
445 | 445 |
message msg; |
446 | 446 |
int good = true; |
447 |
int dead = false; |
|
447 | 448 |
|
448 | 449 |
int health = 50; |
449 | 450 |
|
450 |
while (good) { |
|
451 |
while (good && !dead) {
|
|
451 | 452 |
/* Get a request message. */ |
452 | 453 |
if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) { |
453 | 454 |
printf("driver_receive failed with %d", r); |
... | ... | |
467 | 468 |
|
468 | 469 |
update_game_state(map1, shooter_list, bullet_list);//printf("L468\n"); |
469 | 470 |
|
471 |
if(list_find(shooter_list, shooter1) == list_end(shooter_list)){ printf("YOU DIED\n"); |
|
472 |
good = false; |
|
473 |
dead = true; |
|
474 |
break; |
|
475 |
} //printf("L489\n"); |
|
476 |
|
|
470 | 477 |
//update_scale(); |
471 | 478 |
double angle = get_mouse_angle(shooter1);//printf("L471\n"); |
472 | 479 |
gunner_set_angle(shooter1, angle - M_PI_2); //printf("L472\n"); |
... | ... | |
475 | 482 |
gunner_get_y(shooter1)-ent_get_YLength()/2.0); |
476 | 483 |
|
477 | 484 |
while(list_size(shooter_list) < ZOMBIES_NUM){ |
478 |
gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, gunner_meelee); |
|
485 |
gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, gunner_meelee, 3);
|
|
479 | 486 |
gunner_set_health(zombie, health); |
480 | 487 |
gunner_set_curr_health(zombie, health); |
481 | 488 |
health *= ZOMBIE_HEALTH_FACTOR; |
... | ... | |
483 | 490 |
list_push_back(shooter_list, zombie); |
484 | 491 |
} //printf("L484\n"); |
485 | 492 |
|
486 |
if(list_find(shooter_list, shooter1) == list_end(shooter_list)){ |
|
487 |
good = false; |
|
488 |
break; |
|
489 |
} //printf("L489\n"); |
|
490 | 493 |
graph_clear_screen(); |
491 | 494 |
map_draw (map1); |
495 |
bullet_draw_list(bullet_list); |
|
492 | 496 |
gunner_draw_list(shooter_list); |
493 |
bullet_draw_list(bullet_list); //printf("L502\n"); |
|
494 | 497 |
|
495 | 498 |
text_draw(in_game_timer->text); |
496 | 499 |
|
... | ... | |
553 | 556 |
} |
554 | 557 |
if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n"); |
555 | 558 |
|
559 |
if(dead){ |
|
560 |
printf("YOU DIED\n"); |
|
561 |
} |
|
562 |
|
|
556 | 563 |
timer_dtor(in_game_timer); in_game_timer = NULL; |
557 | 564 |
|
558 | 565 |
return SUCCESS; |
Also available in: Unified diff