Exemplo n.º 1
0
 private void DrawNumber(GraphicsDevice graphics, int n, int x, int y, int alpha, int white)
 {
     graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 4 + n / 8, n % 8, x, y, alpha);
     if (white > 0)
     {
         graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 6 + n / 8, n % 8, x, y, white * alpha / 255);
     }
 }
Exemplo n.º 2
0
        public void DrawPlayerInfo(GraphicsDevice graphics, int alpha)
        {
            graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 2, 0, 8, Settings.SCREEN_HEIGHT - 40, alpha);
            for (int i = 0; i < 6; i++)
            {
                graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 2, 1, 8 + 32 + 32 * i, Settings.SCREEN_HEIGHT - 40, alpha);
            }
            graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 2, 2, 8 + 32 + 192, Settings.SCREEN_HEIGHT - 40, alpha);
            if (player.DrawHealth > 0)
            {
                int damageCount = player.DamageCount;
                graphics.DrawRect(8 + 32, Settings.SCREEN_HEIGHT - 40 + 10, 2 * player.DrawHealth, 1, 255, 128 + damageCount / 2, 128 + damageCount / 2, alpha);
                graphics.DrawRect(8 + 32, Settings.SCREEN_HEIGHT - 40 + 10 + 1, 2 * player.DrawHealth, 12 - 2, 255, damageCount, damageCount, alpha);
                graphics.DrawRect(8 + 32, Settings.SCREEN_HEIGHT - 40 + 10 + 11, 2 * player.DrawHealth, 1, 128 + damageCount / 2, damageCount, damageCount, alpha);
            }

            if (player.CurrentWeapon != Player.Weapon.Pistol)
            {
                graphics.DrawImageAlpha(GameImage.Hud, 96, 32, 3, 0, 8, Settings.SCREEN_HEIGHT - 80, alpha);

                switch (player.CurrentWeapon)
                {
                case Player.Weapon.Machinegun:
                    graphics.DrawImageAlpha(GameImage.Item, 32, 32, 0, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                    break;

                case Player.Weapon.Rocket:
                    graphics.DrawImageAlpha(GameImage.Item, 32, 32, 2, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                    break;

                case Player.Weapon.Shotgun:
                    graphics.DrawImageAlpha(GameImage.Item, 32, 32, 1, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                    break;

                case Player.Weapon.Flamethrower:
                    graphics.DrawImageAlpha(GameImage.Item, 32, 32, 3, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                    break;
                }
            }
            int ammo = player.Ammo;

            if (ammo / 100 > 0)
            {
                DrawNumber(graphics, ammo / 100 % 10, 40, Settings.SCREEN_HEIGHT - 80, alpha, player.AmmoNumColorCount);
            }
            if (ammo / 10 > 0)
            {
                DrawNumber(graphics, ammo / 10 % 10, 40 + 19, Settings.SCREEN_HEIGHT - 80, alpha, player.AmmoNumColorCount);
            }
            if (ammo > 0)
            {
                DrawNumber(graphics, ammo % 10, 40 + 19 + 19, Settings.SCREEN_HEIGHT - 80, alpha, player.AmmoNumColorCount);
            }

            if (player.AmmoHudColorCount > 0)
            {
                graphics.DrawImageAlpha(GameImage.Hud, 96, 32, 3, 1, 8, Settings.SCREEN_HEIGHT - 80, player.AmmoHudColorCount * alpha / 255);
            }
        }
Exemplo n.º 3
0
 public override void Draw(GraphicsDevice graphics)
 {
     if (!background)
     {
         int drawX = (int)Math.Round(position.X) - game.IntCameraX;
         int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 32;
         graphics.DrawImageAlpha(GameImage.Rain, 1, 64, 0, 0, drawX, drawY, 64);
     }
     else
     {
         int drawX = (int)Math.Round(position.X) + game.IntBackgroundX;
         int drawY = (int)Math.Round(position.Y) + game.IntBackgroundY - 32;
         graphics.DrawImageAlpha(GameImage.Rain, 1, 64, 0, 1, drawX, drawY, 32);
     }
 }
Exemplo n.º 4
0
Arquivo: Rain.cs Projeto: sinshu/chaos
 public override void Draw(GraphicsDevice graphics)
 {
     if (!background)
     {
         int drawX = (int)Math.Round(position.X) - game.IntCameraX;
         int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 32;
         graphics.DrawImageAlpha(GameImage.Rain, 1, 64, 0, 0, drawX, drawY, 64);
     }
     else
     {
         int drawX = (int)Math.Round(position.X) + game.IntBackgroundX;
         int drawY = (int)Math.Round(position.Y) + game.IntBackgroundY - 32;
         graphics.DrawImageAlpha(GameImage.Rain, 1, 64, 0, 1, drawX, drawY, 32);
     }
 }
Exemplo n.º 5
0
        public void Draw(GraphicsDevice graphics, int r, int g, int b)
        {
            int topRow    = game.IntCameraY / Settings.BLOCK_WDITH;
            int bottomRow = (game.IntCameraY + Settings.SCREEN_HEIGHT) / Settings.BLOCK_WDITH;
            int leftCol   = game.IntCameraX / Settings.BLOCK_WDITH;
            int rightCol  = (game.IntCameraX + Settings.SCREEN_WIDTH) / Settings.BLOCK_WDITH;

            for (int row = topRow; row <= bottomRow; row++)
            {
                for (int col = leftCol; col <= rightCol; col++)
                {
                    int block = this[row, col];
                    if (block > 0)
                    {
                        int drawX      = col * Settings.BLOCK_WDITH - game.IntCameraX;
                        int drawY      = row * Settings.BLOCK_WDITH - game.IntCameraY;
                        int textureRow = block / 8;
                        int textureCol = block % 8;
                        if (block != 16)
                        {
                            graphics.DrawImage(GameImage.Block, Settings.BLOCK_WDITH, Settings.BLOCK_WDITH, textureRow, textureCol, drawX, drawY, r, g, b);
                        }
                        else
                        {
                            graphics.DrawImageAlpha(GameImage.Block, Settings.BLOCK_WDITH, Settings.BLOCK_WDITH, textureRow, textureCol, drawX, drawY, 128, r, g, b);
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public override void Draw(GraphicsDevice graphics)
        {
            int drawX = (int)Math.Round(position.X) - game.IntCameraX - 16;
            int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 16;

            graphics.DrawImageAlpha(GameImage.PlayerBullet, 32, 32, animation / 2 / 8 + 2, animation / 2 % 8, drawX, drawY, 255 - animation * 8);
        }
Exemplo n.º 7
0
        private void DrawPenguin(int beginTick, int endTick, int dy, GraphicsDevice graphics)
        {
            if (numTicks < beginTick)
            {
                return;
            }
            if (endTick < numTicks)
            {
                return;
            }

            int alpha = 255;

            if (numTicks < (beginTick + endTick) / 2)
            {
                if (numTicks - beginTick < 64)
                {
                    alpha = 4 * (numTicks - beginTick);
                }
            }
            else if ((beginTick + endTick) / 2 < numTicks)
            {
                if (endTick - numTicks < 64)
                {
                    alpha = 4 * (endTick - numTicks);
                }
            }

            graphics.DrawImageAlpha(GameImage.Penguin, 256, 256, 0, 0, (Settings.SCREEN_WIDTH - 256) / 2, (Settings.SCREEN_HEIGHT - 256) / 2 + dy, alpha);
        }
Exemplo n.º 8
0
 public override void Draw(GraphicsDevice graphics)
 {
     int drawX = (int)Math.Round(position.X) - game.IntCameraX - 8;
     int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 8;
     if (animation < 48)
     {
         graphics.DrawImage(GameImage.Debris, 16, 16, type, animation / 2 % 8, drawX, drawY, 64, 64, 64);
     }
     else
     {
         graphics.DrawImageAlpha(GameImage.Debris, 16, 16, type, animation / 2 % 8, drawX, drawY, 255 - 16 * (animation - 48), 64, 64, 64);
     }
 }
Exemplo n.º 9
0
        public override void Draw(GraphicsDevice graphics)
        {
            int drawX = (int)Math.Round(position.X) - game.IntCameraX - 8;
            int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 8;

            if (animation < 48)
            {
                graphics.DrawImage(GameImage.Debris, 16, 16, type, animation / 2 % 8, drawX, drawY, 64, 64, 64);
            }
            else
            {
                graphics.DrawImageAlpha(GameImage.Debris, 16, 16, type, animation / 2 % 8, drawX, drawY, 255 - 16 * (animation - 48), 64, 64, 64);
            }
        }
Exemplo n.º 10
0
 public void Draw(GraphicsDevice graphics)
 {
     int drawX = (int)Math.Round(position.X) - game.IntCameraX;
     int drawY = (int)Math.Round(position.Y) - game.IntCameraY;
     if (visible)
     {
         if (fadeCount < 64)
         {
             graphics.DrawImageAlpha(GameImage.Block, 64, 64, 3, 0, drawX, drawY, 4 * fadeCount);
             graphics.DrawImageAlpha(GameImage.Block, 64, 64, 3, 1, drawX, drawY, 4 * fadeCount);
         }
         else if (slideCount < 20)
         {
             graphics.DrawImage(GameImage.Block, 64, 64, 3, 0, drawX, drawY);
             graphics.DrawImage2(GameImage.Block, 76 + slideCount, 196, 20 - slideCount, 60, drawX + 12, drawY + 4);
             graphics.DrawImage2(GameImage.Block, 96, 196, 20 - slideCount, 60, drawX + 32 + slideCount, drawY + 4);
         }
         else
         {
             graphics.DrawImage(GameImage.Block, 64, 64, 3, 0, drawX, drawY);
         }
     }
 }
Exemplo n.º 11
0
        public void Draw(GraphicsDevice graphics)
        {
            int drawX = (int)Math.Round(position.X) - game.IntCameraX;
            int drawY = (int)Math.Round(position.Y) - game.IntCameraY;

            if (visible)
            {
                if (fadeCount < 64)
                {
                    graphics.DrawImageAlpha(GameImage.Block, 64, 64, 3, 0, drawX, drawY, 4 * fadeCount);
                    graphics.DrawImageAlpha(GameImage.Block, 64, 64, 3, 1, drawX, drawY, 4 * fadeCount);
                }
                else if (slideCount < 20)
                {
                    graphics.DrawImage(GameImage.Block, 64, 64, 3, 0, drawX, drawY);
                    graphics.DrawImage2(GameImage.Block, 76 + slideCount, 196, 20 - slideCount, 60, drawX + 12, drawY + 4);
                    graphics.DrawImage2(GameImage.Block, 96, 196, 20 - slideCount, 60, drawX + 32 + slideCount, drawY + 4);
                }
                else
                {
                    graphics.DrawImage(GameImage.Block, 64, 64, 3, 0, drawX, drawY);
                }
            }
        }
Exemplo n.º 12
0
 private void DrawNumber(GraphicsDevice graphics, int n, int x, int y, int alpha, int white)
 {
     graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 4 + n / 8, n % 8, x, y, alpha);
     if (white > 0)
     {
         graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 6 + n / 8, n % 8, x, y, white * alpha / 255);
     }
 }
Exemplo n.º 13
0
        public void DrawPlayerInfo(GraphicsDevice graphics, int alpha)
        {
            graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 2, 0, 8, Settings.SCREEN_HEIGHT - 40, alpha);
            for (int i = 0; i < 6; i++)
            {
                graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 2, 1, 8 + 32 + 32 * i, Settings.SCREEN_HEIGHT - 40, alpha);
            }
            graphics.DrawImageAlpha(GameImage.Hud, 32, 32, 2, 2, 8 + 32 + 192, Settings.SCREEN_HEIGHT - 40, alpha);
            if (player.DrawHealth > 0)
            {
                int damageCount = player.DamageCount;
                graphics.DrawRect(8 + 32, Settings.SCREEN_HEIGHT - 40 + 10, 2 * player.DrawHealth, 1, 255, 128 + damageCount / 2, 128 + damageCount / 2, alpha);
                graphics.DrawRect(8 + 32, Settings.SCREEN_HEIGHT - 40 + 10 + 1, 2 * player.DrawHealth, 12 - 2, 255, damageCount, damageCount, alpha);
                graphics.DrawRect(8 + 32, Settings.SCREEN_HEIGHT - 40 + 10 + 11, 2 * player.DrawHealth, 1, 128 + damageCount / 2, damageCount, damageCount, alpha);
            }

            if (player.CurrentWeapon != Player.Weapon.Pistol)
            {
                graphics.DrawImageAlpha(GameImage.Hud, 96, 32, 3, 0, 8, Settings.SCREEN_HEIGHT - 80, alpha);

                switch (player.CurrentWeapon)
                {
                    case Player.Weapon.Machinegun:
                        graphics.DrawImageAlpha(GameImage.Item, 32, 32, 0, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                        break;
                    case Player.Weapon.Rocket:
                        graphics.DrawImageAlpha(GameImage.Item, 32, 32, 2, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                        break;
                    case Player.Weapon.Shotgun:
                        graphics.DrawImageAlpha(GameImage.Item, 32, 32, 1, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                        break;
                    case Player.Weapon.Flamethrower:
                        graphics.DrawImageAlpha(GameImage.Item, 32, 32, 3, 0, 9, Settings.SCREEN_HEIGHT - 80, alpha);
                        break;
                }
            }
            int ammo = player.Ammo;
            if (ammo / 100 > 0)
            {
                DrawNumber(graphics, ammo / 100 % 10, 40, Settings.SCREEN_HEIGHT - 80, alpha, player.AmmoNumColorCount);
            }
            if (ammo / 10 > 0)
            {
                DrawNumber(graphics, ammo / 10 % 10, 40 + 19, Settings.SCREEN_HEIGHT - 80, alpha, player.AmmoNumColorCount);
            }
            if (ammo > 0)
            {
                DrawNumber(graphics, ammo % 10, 40 + 19 + 19, Settings.SCREEN_HEIGHT - 80, alpha, player.AmmoNumColorCount);
            }

            if (player.AmmoHudColorCount > 0)
            {
                graphics.DrawImageAlpha(GameImage.Hud, 96, 32, 3, 1, 8, Settings.SCREEN_HEIGHT - 80, player.AmmoHudColorCount * alpha / 255);
            }
        }
Exemplo n.º 14
0
 public override void Draw(GraphicsDevice graphics)
 {
     int drawX = (int)Math.Round(position.X) - game.IntCameraX - 16;
     int drawY = (int)Math.Round(position.Y) - game.IntCameraY - 16;
     graphics.DrawImageAlpha(GameImage.PlayerBullet, 32, 32, animation / 2 / 8 + 2, animation / 2 % 8, drawX, drawY, 255 - animation * 8);
 }
Exemplo n.º 15
0
        private void DrawPenguin(int beginTick, int endTick, int dy, GraphicsDevice graphics)
        {
            if (numTicks < beginTick)
            {
                return;
            }
            if (endTick < numTicks)
            {
                return;
            }

            int alpha = 255;
            if (numTicks < (beginTick + endTick) / 2)
            {
                if (numTicks - beginTick < 64)
                {
                    alpha = 4 * (numTicks - beginTick);
                }
            }
            else if ((beginTick + endTick) / 2 < numTicks)
            {
                if (endTick - numTicks < 64)
                {
                    alpha = 4 * (endTick - numTicks);
                }
            }

            graphics.DrawImageAlpha(GameImage.Penguin, 256, 256, 0, 0, (Settings.SCREEN_WIDTH - 256) / 2, (Settings.SCREEN_HEIGHT - 256) / 2 + dy, alpha);
        }
Exemplo n.º 16
0
Arquivo: Map.cs Projeto: sinshu/chaos
        public void Draw(GraphicsDevice graphics, int r, int g, int b)
        {
            int topRow = game.IntCameraY / Settings.BLOCK_WDITH;
            int bottomRow = (game.IntCameraY + Settings.SCREEN_HEIGHT) / Settings.BLOCK_WDITH;
            int leftCol = game.IntCameraX / Settings.BLOCK_WDITH;
            int rightCol = (game.IntCameraX + Settings.SCREEN_WIDTH) / Settings.BLOCK_WDITH;

            for (int row = topRow; row <= bottomRow; row++)
            {
                for (int col = leftCol; col <= rightCol; col++)
                {
                    int block = this[row, col];
                    if (block > 0)
                    {
                        int drawX = col * Settings.BLOCK_WDITH - game.IntCameraX;
                        int drawY = row * Settings.BLOCK_WDITH - game.IntCameraY;
                        int textureRow = block / 8;
                        int textureCol = block % 8;
                        if (block != 16)
                        {
                            graphics.DrawImage(GameImage.Block, Settings.BLOCK_WDITH, Settings.BLOCK_WDITH, textureRow, textureCol, drawX, drawY, r, g, b);
                        }
                        else
                        {
                            graphics.DrawImageAlpha(GameImage.Block, Settings.BLOCK_WDITH, Settings.BLOCK_WDITH, textureRow, textureCol, drawX, drawY, 128, r, g, b);
                        }
                    }
                }
            }
        }