⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bomberbonus.c

📁 一个炸弹人游戏的源代码(win32 application)
💻 C
字号:
//Clear the bonuses
void ClearBonus ()
{
  int   x, y;
  for (y = 0; y < 17; y++) for (x = 0; x < 17; x++)
    BonusGrid [x][y] = 0;
}

//Draw all bonuses
void DrawBonus ()
{
  int   x, y;
  for (y = 0; y < 17; y++) for (x = 0; x < 17; x++)
    if (BonusGrid [x][y]) DrawBlock (x, y, BonusGrid [x][y] + (Frame & 2), 4);
}

//Check whether a player receives a bonus
void CheckBonus ()
{
  int   p, x, y;

  for (p = 0; p < Players; p++) {
    //Calculate coordinates
    x = PlayerX [p] >> 4;
    y = PlayerY [p] >> 4;

    //If there is a bonus
    if (BonusGrid [x][y]) {
      //Take appropriate action
      if (BonusGrid [x][y] == 1) if (MaxRange [p] < 15) MaxRange [p]++;
      if (BonusGrid [x][y] == 2) if (MaxBombs [p] < 8)  MaxBombs [p]++;
      //Play sound
      PlaySound ((LPCSTR)Bonus, NULL, SND_ASYNC | SND_MEMORY);
      //Remove the bonus
      BonusGrid [x][y] = 0;
      DrawBlock (x, y, 0, 0);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -