Skip to content

Commit

Permalink
完成撞击逻辑的。
Browse files Browse the repository at this point in the history
  • Loading branch information
fwqcuc committed Jul 27, 2016
1 parent 193caed commit a037eeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions snake/FighterFight/auto_fly.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ int be_hit(LPAUTO_FLY enemy, LPAUTO_FLY bullet)

if (enemy->x + enemy->ratio_x > bullet->x &&
enemy->x - enemy->ratio_x < bullet->x &&
enemy->y + enemy->ratio_y < bullet->y &&
enemy->y - enemy->ratio_y > bullet->y)
enemy->y + enemy->ratio_y > bullet->y &&
enemy->y - enemy->ratio_y < bullet->y)
{
enemy->state = FLY_HIT;
bullet->state = FLY_HIT;
fly_be_hit(enemy);
fly_be_hit(bullet);
return 1;
}
else
Expand Down
2 changes: 1 addition & 1 deletion snake/FighterFight/auto_fly.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef struct _AUTO_FLY
#define RAND_DIR ((double)(rand()*2-RAND_MAX))/(RAND_MAX*5)

#define gen_bullet(x, y) create_fly(FLY_TYPE_BULLET, x, y, RAND_DIR, rand()%10+5, 0, 0, 0)
#define gen_enemy() create_fly(FLY_TYPE_ENEMY, rand()%MAX_X, 0, 0, 3, 0, 0, 0)
#define gen_enemy() create_fly(FLY_TYPE_ENEMY, rand()%MAX_X, 0, 0, 3, 0, 10, 10)

int flys_init();
LPAUTO_FLY create_fly(
Expand Down

0 comments on commit a037eeb

Please sign in to comment.