Revision 301
changed shooters
ent.c | ||
---|---|---|
23 | 23 |
sprite_t *dude; |
24 | 24 |
sprite_t *weapon; |
25 | 25 |
double health, current_health; |
26 |
gunner_type type; |
|
26 | 27 |
}; |
27 |
gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon){ |
|
28 |
gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon, gunner_type tp){
|
|
28 | 29 |
gunner_t *ret = malloc(sizeof(gunner_t)); |
29 | 30 |
if(ret == NULL) return NULL; |
30 | 31 |
ret->spawn_x = 0.0; |
... | ... | |
33 | 34 |
ret->y = 0.0; |
34 | 35 |
ret->health = 100; |
35 | 36 |
ret->current_health = ret->health; |
37 |
ret->type = tp; |
|
36 | 38 |
ret->dude = sprite_ctor(dude ); |
37 | 39 |
ret->weapon = sprite_ctor(weapon); |
38 | 40 |
if(ret->dude == NULL || ret->weapon == NULL){ |
... | ... | |
69 | 71 |
double (gunner_get_curr_health) (const gunner_t *p){ return p->current_health; } |
70 | 72 |
int16_t (gunner_get_x_screen) (const gunner_t *p){ return (p->x-x_origin)*scale; } |
71 | 73 |
int16_t (gunner_get_y_screen) (const gunner_t *p){ return (p->y-y_origin)*scale; } |
74 |
gunner_type (gunner_get_type) (const gunner_t *p){ return p->type; } |
|
72 | 75 |
void (gunner_draw)(gunner_t *p){ |
73 | 76 |
const int16_t x_screen = gunner_get_x_screen(p); |
74 | 77 |
const int16_t y_screen = gunner_get_y_screen(p); |
Also available in: Unified diff