Пример #1
0
        private void DrawTiles()
        {
            //Draw downtiles
            for (int x = newTileGrid.GetLength(0) - 1; x >= 0; x--)
            {
                for (int y = newTileGrid.GetLength(1) - 1; y >= 0; y--)
                {
                    if (newTileGrid[x, y] != null)
                    {
                        TileDrawer.DrawTileAt(spriteBatch, newTileGrid[x, y].type, new Point(x, y));
                    }
                }
            }

            //Drawuptiles
            for (int x = newTileGrid.GetLength(0) - 1; x >= 0; x--)
            {
                for (int y = newTileGrid.GetLength(1) - 1; y >= 0; y--)
                {
                    if (newTileGrid[x, y] != null)
                    {
                        TileDrawer.DrawTileRoofingAt(spriteBatch, newTileGrid[x, y].type, new Point(x, y));
                    }
                }
            }
        }
Пример #2
0
        public void DrawBelow(Minijam32 game, SpriteBatch batch)
        {
            //Tiles
            for (int x = tileGrid.GetLength(0) - 1; x >= 0; x--)
            {
                for (int y = tileGrid.GetLength(1) - 1; y >= 0; y--)
                {
                    TileDrawer.DrawTileAt(batch, tileGrid[x, y].type, new Point(x, y));
                }
            }

            //Bombs
            foreach (var location in this.plantedBombs.Keys)
            {
                int bombFuseCh = (int)(this.plantedBombs[location]);

                if (bombFuseCh > 1000)
                {
                    if ((bombFuseCh / 100) % 5 == 0)
                    {
                        TileDrawer.DrawTileAt(batch, TileData.Type.BombOne, location);
                    }
                    else
                    {
                        TileDrawer.DrawTileAt(batch, TileData.Type.BombTwo, location);
                    }
                }
                else
                {
                    if ((bombFuseCh / 100) % 2 == 0)
                    {
                        TileDrawer.DrawTileAt(batch, TileData.Type.BombOne, location);
                    }
                    else
                    {
                        TileDrawer.DrawTileAt(batch, TileData.Type.BombTwo, location);
                    }
                }
            }

            //Enemies
            foreach (var enemy in this.enemies)
            {
                EnemyDrawer.DrawThisTypeAt(batch, enemy);
            }
        }
Пример #3
0
        static public void DrawCurrentState(SpriteBatch batch, Point tilePos)
        {
            //State is literally draw state, so it makes sense to put & update it right on draw cycles
            UpdateCurrentState();

            if (!PlayerDataManager.isDead)
            {
                //Select the correct source rect & draw it
                if (!isMoving)
                {
                    batch.Draw
                    (
                        spritesheet,
                        new Vector2(tilePos.X * TileData.ScaledTileSize.X, tilePos.Y * TileData.ScaledTileSize.Y) + heroDrawOffset * Minijam32.Scale,
                        stateSourceRect[currentState],
                        Color.White,
                        0.0f,
                        Vector2.Zero, //table of origins for walls?
                        Minijam32.Scale,
                        SpriteEffects.None,
                        0.0f
                    );
                }
                else
                {
                    var drawPos = new Vector2(tilePos.X * TileData.ScaledTileSize.X, tilePos.Y * TileData.ScaledTileSize.Y) + animationDrawOffset;
                    switch (currentState)
                    {
                    case State.FacingDownStill:
                        movingDown.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(0, maxFrames - frameStep * ((int)currentAnimationMs / (int)oneFrameTime)));
                        break;

                    case State.FacingLeftStill:
                        movingLeft.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(frameStep * ((int)currentAnimationMs / (int)oneFrameTime), 0));
                        break;

                    case State.FacingRightStill:
                        movingRight.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(maxFrames - frameStep * ((int)currentAnimationMs / (int)oneFrameTime), 0));
                        break;

                    case State.FacingUpStill:
                        movingUp.Draw(batch, SpriteEffects.None, Minijam32.DeltaDraw, drawPos + new Vector2(0, frameStep * ((int)currentAnimationMs / (int)oneFrameTime)));
                        break;
                    }
                }
            }
            else
            {
                if (currentState == State.FacingDownStill)
                {
                    TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathDown, PlayerDataManager.tilePosition);
                }
                if (currentState == State.FacingLeftStill)
                {
                    TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathLeft, PlayerDataManager.tilePosition);
                }
                if (currentState == State.FacingRightStill)
                {
                    TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathRight, PlayerDataManager.tilePosition);
                }
                if (currentState == State.FacingUpStill)
                {
                    TileDrawer.DrawTileAt(batch, TileData.Type.CharacterDeathUp, PlayerDataManager.tilePosition);
                }
            }
        }
Пример #4
0
 private void DrawTileInHand()
 {
     TileDrawer.DrawTileAt(spriteBatch, tileInHand, currentTile);
 }