示例#1
0
        private void addCheckpointTileAt(int x, int y)
        {
            Vector2 tilePosition = calculateTilePosition(x, y);

            CheckpointTile checkPointTile = new CheckpointTile(world, tilePosition, this.LevelMap.TileWidth * 3f, this.LevelMap.TileHeight * 3f, entityManager);

            addTile(checkPointTile);
        }
示例#2
0
文件: Map.cs 项目: psykano/STFU-xna
        private void addCheckpointTileAt(int x, int y)
        {
            Vector2 tilePosition = calculateTilePosition(x, y);

            CheckpointTile checkPointTile = new CheckpointTile(world, tilePosition, this.LevelMap.TileWidth * 3f, this.LevelMap.TileHeight * 3f, entityManager);
            addTile(checkPointTile);
        }
示例#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);
                }
            }
        }