diff options
-rw-r--r-- | src/hvy_guns.c | 27 | ||||
-rw-r--r-- | src/player.c | 2 | ||||
-rw-r--r-- | src/res/pacer.ase | bin | 553 -> 504 bytes |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/hvy_guns.c b/src/hvy_guns.c index 43fd1f1..1eabbe2 100644 --- a/src/hvy_guns.c +++ b/src/hvy_guns.c @@ -11,7 +11,7 @@ #define HVY_SHOTGUN_RELOAD 150 -#define HVY_REPEATER_RELOAD 60 +#define HVY_REPEATER_RELOAD 120 #define HVY_REPEATER_ROUNDS 3 #define HVY_CHAINGUN_RELOAD 30 @@ -19,6 +19,29 @@ static int bullet_update(struct projectile *self) { self->x += self->velocity.x; + self->y += self->velocity.y; + if (collision_solid(tilemap_tile(tilemap, from_fixed(self->x), from_fixed(self->y)))) { + return 1; + } + + self->hp--; + int x = from_fixed(self->x); + int y = from_fixed(self->y); + self->hitbox = (struct hitbox) {.left = x, .right = x, .top = y, .bottom = y}; + if (hitbox_overlap(self->hitbox, entities.player[0].hitbox)) { + if (entities.player[0].hurt(entities.player + 0, (struct damage) {1, 60})) { + //return 1; + } + } + if (self->hp == 0) { + return 1; + self->state = 0; + } + return 0; +} + +static int bouncy_bullet_update(struct projectile *self) { + self->x += self->velocity.x; if (collision_solid(tilemap_tile(tilemap, from_fixed(self->x), from_fixed(self->y)))) { self->velocity.x = -self->velocity.x; self->x += self->velocity.x; @@ -144,7 +167,7 @@ int hvy_blaster(struct gun *self, struct entity *parent, struct entity *target) } if (target != NULL) { entities.projectile[entities.projectiles] = (struct projectile) { - .update = bullet_update, + .update = bouncy_bullet_update, .draw = bullet_draw, .free = bullet_free, .x = POS_X, .y = POS_Y, diff --git a/src/player.c b/src/player.c index 0bf09de..126b2ea 100644 --- a/src/player.c +++ b/src/player.c @@ -81,7 +81,7 @@ static int slash_update(struct projectile *self) { continue; } if (hitbox_overlap(self->hitbox, entities.enemy[i].hitbox)) { - entities.enemy[i].hurt(entities.enemy + i, (struct damage) {self->ext == SLASH_STRONG? 2: 1, self->ext == SLASH_NORMAL? 10: 60}); + entities.enemy[i].hurt(entities.enemy + i, (struct damage) {(enum slash_type) self->ext == SLASH_STRONG? 2: 1, self->ext == SLASH_NORMAL? 10: 60}); } } struct particle *part = entities.particle + entities.particles; diff --git a/src/res/pacer.ase b/src/res/pacer.ase index bd22044..6e05528 100644 --- a/src/res/pacer.ase +++ b/src/res/pacer.ase Binary files differ |