Esempio n. 1
0
 public void DrawBackground(SpriteBatch spriteBatch)
 {
     // Draw the wall
     foreach (WallTile wallTile in map.WallTiles)
     {
         wallFrame.Position = wallTile.ScreenPosition;
         wallFrame.Rotation = wallTile.ScreenRotation;
         wallFrame.Draw(spriteBatch);
     }
 }
Esempio n. 2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            // Draw the player
            if (!player.Health.Dead)
            {
                if (blink)
                {
                    // Draw the current animation
                    currentAnimation.DrawOpaqueWithColor(spriteBatch, blinkColor);

                    // Draw the eyes
                    eyesFrame.DrawOpaqueWithColor(spriteBatch, blinkColor);

                    // Draw the weapons if the player isn't hit
                    if (!player.Health.Hit)
                    {
                        gunRepresentation.DrawOpaqueWithColor(spriteBatch, blinkColor);
                        swordRepresentation.DrawOpaqueWithColor(spriteBatch, blinkColor);
                    }
                }
                else
                {
                    // Draw the current animation
                    currentAnimation.Draw(spriteBatch);

                    // Draw the eyes
                    eyesFrame.Draw(spriteBatch);

                    // Draw the weapons if the player isn't hit
                    if (!player.Health.Hit)
                    {
                        gunRepresentation.Draw(spriteBatch);
                        swordRepresentation.Draw(spriteBatch);
                    }
                }
            }

            // Draw the bullets
            gunRepresentation.DrawBullets(spriteBatch);
            swordRepresentation.DrawBullets(spriteBatch);

            // Draw the dash trails
            dashTrailEmitter.DrawOpaque(spriteBatch);
        }
Esempio n. 3
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            // Draw the tiles
            foreach (Entity tile in map.Tiles)
            {
                if (!tile.Visible)
                {
                    continue;
                }

                if (tile is CheckpointTile)
                {
                    checkpointPoleFrame.Position = tile.ScreenPosition;
                    checkpointPoleFrame.Rotation = tile.ScreenRotation;
                    checkpointPoleFrame.Draw(spriteBatch);

                    CheckpointTile checkpointTile = tile as CheckpointTile;
                    if (checkpointTile.Activated)
                    {
                        checkpointFlagFrame.Position = tile.ScreenPosition;
                        checkpointFlagFrame.Rotation = tile.ScreenRotation;
                        checkpointFlagFrame.Draw(spriteBatch);
                    }
                }
                if (tile is GroundTile)
                {
                    groundFrame.Position = tile.ScreenPosition;
                    groundFrame.Rotation = tile.ScreenRotation;
                    groundFrame.Draw(spriteBatch);
                }
                else if (tile is SpikeTile)
                {
                    spikeFrame.Position = tile.ScreenPosition;
                    spikeFrame.Rotation = tile.ScreenRotation;
                    spikeFrame.Draw(spriteBatch);
                }
                else if (tile is StaticPlatformTile)
                {
                    staticPlatformFrame.Position = tile.ScreenPosition;
                    staticPlatformFrame.Rotation = tile.ScreenRotation;
                    staticPlatformFrame.Draw(spriteBatch);
                }
                else if (tile is MovingPlatformTile)
                {
                    movingPlatformFrame.Rotation = tile.ScreenRotation;
                    movingPlatformFrame.Position = tile.ScreenPosition;
                    // check if it's a big tile
                    if (tile.ScreenWidth <= map.LevelMap.TileWidth)
                    {
                        movingPlatformFrame.Draw(spriteBatch);
                    }
                    else
                    {
                        movingPlatformFrame.Position -= Vector2.UnitX * tile.ScreenWidth * 0.25f;
                        movingPlatformFrame.Draw(spriteBatch);
                        movingPlatformFrame.Position += Vector2.UnitX * tile.ScreenWidth * 0.5f;
                        movingPlatformFrame.Draw(spriteBatch);
                    }
                }
                else if (tile is FallingPlatformTile)
                {
                    fallingPlatformFrame.Position = tile.ScreenPosition;
                    fallingPlatformFrame.Rotation = tile.ScreenRotation;
                    fallingPlatformFrame.Draw(spriteBatch);
                }
            }
        }