diff --git a/data/Makefile.am b/data/Makefile.am index 5ce339b..4330dcb 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,6 +8,7 @@ EXTRA_DIST = \ explosion_small \ item_gem \ item_heart \ + ship_green \ weapon_bomb \ weapon_fragbomb \ $(NULL) diff --git a/data/ship_green b/data/ship_green new file mode 100644 index 0000000..2fc0096 --- /dev/null +++ b/data/ship_green @@ -0,0 +1,7 @@ +6 3 2 1 + /\ + (()) +I<__>I + cc + cddc +cccccc diff --git a/src/collide.c b/src/collide.c index 9375484..bb7ebfd 100644 --- a/src/collide.c +++ b/src/collide.c @@ -278,18 +278,18 @@ void collide_player_tunnel(game *g, player *p, tunnel *t, explosions *ex) return; } - if(p->x <= t->left[p->y]) + if(p->x - 2 <= t->left[p->y]) { p->x += 3; p->vx = 2; - add_explosion(g, ex, p->x+1, p->y-1, 0, 0, EXPLOSION_SMALL); + add_explosion(g, ex, p->x-1, p->y, 0, 0, EXPLOSION_SMALL); p->life -= 180; } - else if(p->x + 5 >= t->right[p->y]) + else if(p->x + 3 >= t->right[p->y]) { p->x -= 3; p->vx = -2; - add_explosion(g, ex, p->x+4, p->y-1, 0, 0, EXPLOSION_SMALL); + add_explosion(g, ex, p->x+2, p->y, 0, 0, EXPLOSION_SMALL); p->life -= 180; } } diff --git a/src/main.c b/src/main.c index 6bd7bb1..ad474b7 100644 --- a/src/main.c +++ b/src/main.c @@ -124,10 +124,10 @@ static void start_game (game *g) g->p->vx = -2; break; case 'j': - if(g->p->y < g->h - 2) g->p->y += 1; + if(g->p->y < g->h - 3) g->p->y += 1; break; case 'k': - if(g->p->y > 1) g->p->y -= 1; + if(g->p->y > 2) g->p->y -= 1; break; case 'l': g->p->vx = 2; @@ -136,43 +136,43 @@ static void start_game (game *g) if(g->p->special >= COST_NUKE) { g->p->special -= COST_NUKE; - add_weapon(g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_NUKE); + add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, 0, 0, WEAPON_NUKE); } break; case 'f': if(g->p->special >= COST_FRAGBOMB) { g->p->special -= COST_FRAGBOMB; - add_weapon(g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, -16, WEAPON_FRAGBOMB); + add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, 0, -16, WEAPON_FRAGBOMB); } break; case 'b': if(g->p->special >= COST_BEAM) { g->p->special -= COST_BEAM; - add_weapon(g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, 0, WEAPON_BEAM); + add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, 0, 0, WEAPON_BEAM); } break; case ' ': if(g->p->weapon == 0) { g->p->weapon = 4; - add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, 0, -32, WEAPON_LASER); - add_weapon(g, g->wp, (g->p->x + 5) << 4, g->p->y << 4, 0, -32, WEAPON_LASER); + add_weapon(g, g->wp, (g->p->x - 2) << 4, g->p->y << 4, 0, -32, WEAPON_LASER); + add_weapon(g, g->wp, (g->p->x + 3) << 4, g->p->y << 4, 0, -32, WEAPON_LASER); /* Extra schtuph */ - add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, -24, -16, WEAPON_SEEKER); - add_weapon(g, g->wp, (g->p->x + 5) << 4, g->p->y << 4, 24, -16, WEAPON_SEEKER); + add_weapon(g, g->wp, (g->p->x - 2) << 4, g->p->y << 4, -24, -16, WEAPON_SEEKER); + add_weapon(g, g->wp, (g->p->x + 3) << 4, g->p->y << 4, 24, -16, WEAPON_SEEKER); /* More schtuph */ - add_weapon(g, g->wp, (g->p->x + 1) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); - add_weapon(g, g->wp, (g->p->x + 4) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); - /* Even more schtuph */ + add_weapon(g, g->wp, (g->p->x - 1) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); add_weapon(g, g->wp, (g->p->x + 2) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); - add_weapon(g, g->wp, (g->p->x + 3) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); + /* Even more schtuph */ + add_weapon(g, g->wp, g->p->x << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); + add_weapon(g, g->wp, (g->p->x + 1) << 4, (g->p->y - 1) << 4, 0, -32, WEAPON_LASER); /* Extra schtuph */ - add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, -32, 0, WEAPON_SEEKER); - add_weapon(g, g->wp, (g->p->x + 5) << 4, g->p->y << 4, 32, 0, WEAPON_SEEKER); + add_weapon(g, g->wp, (g->p->x - 2) << 4, g->p->y << 4, -32, 0, WEAPON_SEEKER); + add_weapon(g, g->wp, (g->p->x + 3) << 4, g->p->y << 4, 32, 0, WEAPON_SEEKER); /* MORE SCHTUPH! */ - add_weapon(g, g->wp, (g->p->x + 2) << 4, g->p->y << 4, 0, -16, WEAPON_BOMB); + add_weapon(g, g->wp, g->p->x << 4, g->p->y << 4, 0, -16, WEAPON_BOMB); } break; } diff --git a/src/player.c b/src/player.c index 00a7d4f..601ae2b 100644 --- a/src/player.c +++ b/src/player.c @@ -26,13 +26,15 @@ #include "common.h" +struct ee_sprite *ship_sprite; + /* Init tunnel */ player * create_player(game *g) { player *p = malloc(sizeof(player)); p->x = g->w / 2; - p->y = g->h - 2; + p->y = g->h - 3; p->vx = 0; p->vy = 0; p->weapon = 0; @@ -40,6 +42,8 @@ player * create_player(game *g) p->life = MAX_LIFE; p->dead = 0; + ship_sprite = ee_load_sprite("data/ship_green"); + return p; } @@ -51,25 +55,15 @@ void free_player(player *p) void draw_player(game *g, player *p) { if(p->dead) - { return; - } - ee_color(EE_GREEN); - ee_putstr(p->x + 2, p->y - 2, "/\\"); - ee_putchar(p->x + 1, p->y - 1, '('); - ee_putchar(p->x + 4, p->y - 1, ')'); - ee_putstr(p->x, p->y, "I<__>I"); - ee_color(EE_YELLOW); - ee_putstr(p->x + 2, p->y - 1, "()"); + ee_draw_sprite(p->x, p->y, ship_sprite); } void update_player(game *g, player *p) { if(p->dead) - { return; - } if(p->life <= 0) { @@ -80,40 +74,26 @@ void update_player(game *g, player *p) /* Update weapon stats */ if(p->weapon) - { p->weapon--; - } if(p->special < MAX_SPECIAL) - { p->special++; - } /* Update life */ if(p->life < MAX_LIFE) - { p->life++; - } /* Update coords */ p->x += p->vx; if(p->vx < 0) - { p->vx++; - } else if(p->vx > 0) - { p->vx--; - } if(p->x < 1) - { p->x = 1; - } else if(p->x > g->w - 7) - { p->x = g->w - 7; - } } diff --git a/src/weapons.c b/src/weapons.c index 6c1226c..b5c12a8 100644 --- a/src/weapons.c +++ b/src/weapons.c @@ -219,7 +219,7 @@ void update_weapons(game *g, weapons *wp) break; case WEAPON_BEAM: - wp->x[i] = (g->p->x + 2) << 4; + wp->x[i] = g->p->x << 4; wp->y[i] = g->p->y << 4; wp->n[i]--; if(wp->n[i] < 0) @@ -447,11 +447,15 @@ static void draw_nuke(int x, int y, int frame) /* Lots of duplicate pixels, but we don't care */ ee_color(EE_BLUE); - ee_draw_circle(x, y, r++, ':'); + ee_draw_ellipse(x, y, r, r / 2, ':'); + ee_draw_ellipse(x, y, r + 1, r / 2, ':'); + ee_draw_ellipse(x, y, r + 2, r / 2, ':'); ee_color(EE_CYAN); - ee_draw_circle(x, y, r++, '%'); + ee_draw_ellipse(x, y, r + 2, r / 2 + 1, '%'); + ee_draw_ellipse(x, y, r + 3, r / 2 + 1, '%'); ee_color(EE_WHITE); - ee_draw_circle(x, y, r++, '#'); - ee_draw_circle(x, y, r++, '#'); + ee_draw_ellipse(x, y, r + 3, r / 2 + 2, '#'); + ee_draw_ellipse(x, y, r + 4, r / 2 + 2, '#'); + ee_draw_ellipse(x, y, r + 4, r / 2 + 3, '#'); }