Exemple #1
0
 public static void RenderPowerUps(
     List <PowerUp> powerUps,
     TranslatedDTDanmakuDisplay display)
 {
     foreach (var powerUp in powerUps)
     {
         int powerUpX = ((int)powerUp.xMillis / 1000) - ((int)PowerUp.SPRITE_NUM_X_PIXELS) / 2;
         int powerUpY = 700 - ((int)powerUp.yMillis / 1000) - ((int)PowerUp.SPRITE_NUM_Y_PIXELS) / 2;
         display.DrawImage(DTDanmakuImage.PowerUp, powerUpX, powerUpY);
     }
 }
Exemple #2
0
        public static void RenderPlayerLifeIcons(
            int numberOfLivesRemaining,
            TranslatedDTDanmakuDisplay display)
        {
            int width = (int)display.GetWidth(DTDanmakuImage.PlayerLifeIcon);

            for (int i = 0; i < numberOfLivesRemaining; i++)
            {
                display.DrawImage(DTDanmakuImage.PlayerLifeIcon,
                                  x: 1000 - 1 - (i + 1) * (width + 1),
                                  y: 3);
            }
        }
Exemple #3
0
        public static void RenderPlayer(
            Player player,
            TranslatedDTDanmakuDisplay display,
            bool debugMode,
            bool debug_renderHitboxes)
        {
            if (!player.isDead)
            {
                int playerX = ((int)player.xMillis / 1000) - ((int)Player.SPRITE_NUM_X_PIXELS) / 2;
                int playerY = 700 - ((int)player.yMillis / 1000) - ((int)Player.SPRITE_NUM_Y_PIXELS) / 2;

                if (player.playerInvincibilityTimeRemainingMillis.HasValue && player.playerInvincibilityTimeRemainingMillis.Value > 0)
                {
                    display.DrawImage(DTDanmakuImage.PlayerShipInvulnerable, playerX, playerY);
                }
                else
                {
                    display.DrawImage(DTDanmakuImage.PlayerShip, playerX, playerY);
                }

                /*
                 *      Note that since these debug things bypass regular game logic, they may break other stuff or crash the program
                 *      (Should be used for debugging / development only)
                 */
                if (debugMode)
                {
                    if (debug_renderHitboxes)
                    {
                        display.DrawRectangle(
                            x: ((int)(player.xMillis / 1000L)) - 3,
                            y: 700 - ((int)(player.yMillis / 1000L)) - 3,
                            width: 7,
                            height: 7,
                            color: new DTColor(255, 0, 0),
                            fill: true);
                    }
                }
            }
        }
Exemple #4
0
 public static void RenderPlayerBullets(
     List <PlayerBullet> playerBullets,
     TranslatedDTDanmakuDisplay display)
 {
     foreach (var playerBullet in playerBullets)
     {
         int playerBulletX = ((int)playerBullet.xMillis / 1000) - ((int)PlayerBullet.SPRITE_NUM_X_PIXELS) / 2;
         int playerBulletY = 700 - ((int)playerBullet.yMillis / 1000) - ((int)PlayerBullet.SPRITE_NUM_Y_PIXELS) / 2;
         if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Main)
         {
             display.DrawImage(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY);
         }
         else if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Side1Left)
         {
             display.DrawImageRotatedCounterclockwise(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY, 10 * 1000);
         }
         else if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Side1Right)
         {
             display.DrawImageRotatedCounterclockwise(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY, -10 * 1000);
         }
         else if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Side2Left)
         {
             display.DrawImageRotatedCounterclockwise(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY, 20 * 1000);
         }
         else if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Side2Right)
         {
             display.DrawImageRotatedCounterclockwise(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY, -20 * 1000);
         }
         else if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Side3Left)
         {
             display.DrawImageRotatedCounterclockwise(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY, 30 * 1000);
         }
         else if (playerBullet.bulletType == PlayerBullet.PlayerBulletType.Side3Right)
         {
             display.DrawImageRotatedCounterclockwise(DTDanmakuImage.PlayerBullet, playerBulletX, playerBulletY, -30 * 1000);
         }
         else
         {
             throw new Exception();
         }
     }
 }