Revision 232
death of shooters
ent.c | ||
---|---|---|
20 | 20 |
|
21 | 21 |
struct gunner{ |
22 | 22 |
double x, y; //real position |
23 |
double spawn_x, spawn_y; |
|
23 | 24 |
sprite_t *dude; |
24 | 25 |
sprite_t *weapon; |
25 | 26 |
int health, current_health; |
... | ... | |
27 | 28 |
gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon){ |
28 | 29 |
gunner_t *ret = malloc(sizeof(gunner_t)); |
29 | 30 |
if(ret == NULL) return NULL; |
31 |
ret->spawn_x = 0.0; |
|
32 |
ret->spawn_y = 0.0; |
|
30 | 33 |
ret->x = 0.0; |
31 | 34 |
ret->y = 0.0; |
32 | 35 |
ret->health = 100; |
... | ... | |
45 | 48 |
free(p); |
46 | 49 |
} |
47 | 50 |
void (gunner_set_pos) (gunner_t *p, double x, double y){ p->x = x; p->y = y; } |
51 |
void (gunner_set_spawn) (gunner_t *p, double x, double y){ p->spawn_x = x; p->spawn_y = y; } |
|
48 | 52 |
void (gunner_set_angle)(gunner_t *p, double angle ){ |
49 | 53 |
sprite_set_angle(p->dude , angle); |
50 | 54 |
sprite_set_angle(p->weapon, angle); |
... | ... | |
59 | 63 |
} |
60 | 64 |
double (gunner_get_x) (const gunner_t *p){ return p->x; } |
61 | 65 |
double (gunner_get_y) (const gunner_t *p){ return p->y; } |
66 |
double (gunner_get_spawn_x) (const gunner_t *p){ return p->spawn_x; } |
|
67 |
double (gunner_get_spawn_y) (const gunner_t *p){ return p->spawn_y; } |
|
62 | 68 |
double (gunner_get_angle) (const gunner_t *p){ return sprite_get_angle(p->dude); } |
63 | 69 |
int (gunner_get_health) (const gunner_t *p){ return p->health; } |
64 | 70 |
int (gunner_get_curr_health) (const gunner_t *p){ return p->current_health; } |
... | ... | |
107 | 113 |
ret-> y = y; |
108 | 114 |
ret->vx = vx; |
109 | 115 |
ret->vy = vy; |
110 |
ret->damage = 1; |
|
116 |
ret->damage = 10;
|
|
111 | 117 |
ret->b = sprite_ctor(b); |
112 | 118 |
if(ret->b == NULL){ |
113 | 119 |
bullet_dtor(ret); |
Also available in: Unified diff