Example #1
0
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            g.DrawAnimationPlayer(arrowsAnimationPlayer, Zone.ImageVariantID, Position, Graphics.DepthLayer);
            g.DrawAnimationPlayer(turnstileAnimationPlayer, Zone.ImageVariantID, Position, Graphics.DepthLayer);
        }
Example #2
0
        public override void Draw(RoomGraphics g)
        {
            DepthLayer depthLayer = Graphics.CurrentDepthLayer;

            // Draw tools under.
            foreach (UnitTool tool in tools)
            {
                if (!tool.DrawAboveUnit)
                {
                    Vector2F drawPosition = position - new Vector2F(0, zPosition) + Graphics.DrawOffset + tool.DrawOffset;
                    g.DrawAnimationPlayer(tool.AnimationPlayer, tool.ImageVariantID, drawPosition, depthLayer, position);
                }
            }

            // Draw entity.
            base.Draw(g);

            // Draw tools over.
            foreach (UnitTool tool in tools)
            {
                if (tool.DrawAboveUnit)
                {
                    Vector2F drawPosition = position - new Vector2F(0, zPosition) + Graphics.DrawOffset + tool.DrawOffset;
                    g.DrawAnimationPlayer(tool.AnimationPlayer, tool.ImageVariantID, drawPosition, depthLayer, position);
                }
            }
        }
 public override void DrawOver(RoomGraphics g)
 {
     if (isSwitching)
     {
         hookedEntity.Graphics.Draw(g, DepthLayer.RisingTile);
     }
 }
 public override void DrawOver(RoomGraphics g)
 {
     // Draw the gale effect.
     if (timer % 2 == 0 || !isRising) {
         g.DrawAnimationPlayer(galeAnimationPlayer, monsterPosition + monster.CenterOffset -
             new Vector2F(0, galeZPosition), DepthLayer.EffectMonsterBurnFlame);
     }
 }
Example #5
0
 public override void DrawOver(RoomGraphics g)
 {
     // Draw the gale effect.
     if (timer % 2 == 0 || !isRising)
     {
         g.DrawAnimationPlayer(galeAnimationPlayer, monsterPosition + monster.CenterOffset -
                               new Vector2F(0, galeZPosition), DepthLayer.EffectMonsterBurnFlame);
     }
 }
Example #6
0
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            if (flameAnimation != null)
            {
                g.DrawAnimation(flameAnimation, GameControl.RoomTicks,
                                Center - new Vector2F(0, 9), Graphics.DepthLayer);
            }
        }
Example #7
0
        public override void Draw(RoomGraphics g)
        {
            //base.Draw(g);

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    g.DrawSprite(GameData.SPR_TILE_MOVING_PLATFORM, Zone.ImageVariantID,
                                 Position + new Point2I(x, y) * GameSettings.TILE_SIZE, DepthLayer.TileLayer1);
                }
            }
        }
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            // Draw collectibles over boomerang.
            for (int i = 0; i < collectibles.Count; i++) {
                Collectible collectible = collectibles[i];
                collectible.SetPositionByCenter(Center);
                collectible.ZPosition = zPosition;
                float percent = i / (float) collectibles.Count;
                collectible.Graphics.Draw(g, Graphics.CurrentDepthLayer);
            }
        }
        public void Draw(RoomGraphics g)
        {
            if (!isVisible)
            {
                return;
            }

            // Determine the depth layer based on the tile grid layer.
            if (tile.Layer == 0)
            {
                depthLayer = DepthLayer.TileLayer1;
            }
            else if (tile.Layer == 1)
            {
                depthLayer = DepthLayer.TileLayer2;
            }
            else if (tile.Layer == 2)
            {
                depthLayer = DepthLayer.TileLayer3;
            }

            // Determine draw position.
            Vector2F drawPosition = (useAbsoluteDrawPosition ?
                                     absoluteDrawPosition : tile.Position);

            drawPosition += (raisedDrawOffset + drawOffset);

            // Draw the tile's as-object sprite.
            if (tile.IsMoving && !tile.SpriteAsObject.IsNull)
            {
                g.DrawSpriteAnimation(tile.SpriteAsObject, imageVariant,
                                      tile.RoomControl.GameControl.RoomTicks,
                                      drawPosition, depthLayer, tile.Position);
            }
            // Draw the animation player.
            else
            {
                float playbackTime;
                if (syncPlaybackWithRoomTicks)
                {
                    playbackTime = tile.RoomControl.GameControl.RoomTicks;
                }
                else
                {
                    playbackTime = animationPlayer.PlaybackTime;
                }

                g.DrawAnimationPlayer(animationPlayer, imageVariant,
                                      playbackTime, drawPosition, depthLayer, tile.Position);
            }
        }
Example #10
0
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            // Draw collectibles over boomerang.
            for (int i = 0; i < collectibles.Count; i++)
            {
                Collectible collectible = collectibles[i];
                collectible.SetPositionByCenter(Center);
                collectible.ZPosition = zPosition;
                float percent = i / (float)collectibles.Count;
                collectible.Graphics.Draw(g, Graphics.CurrentDepthLayer);
            }
        }
Example #11
0
        public override void Draw(RoomGraphics g)
        {
            state.DrawUnder(g);
            if (specialState != null && specialState.IsActive)
            {
                specialState.DrawUnder(g);
            }

            base.Draw(g);

            state.DrawOver(g);
            if (specialState != null && specialState.IsActive)
            {
                specialState.DrawOver(g);
            }
        }
        public override void DrawOver(RoomGraphics g)
        {
            carryObject.Position	= player.Position + objectDrawOffset;
            carryObject.ZPosition	= player.ZPosition + objectZOffset;
            if (!isPickingUp && Directions.IsHorizontal(player.Direction))
                carryObject.ZPosition += 1;

            // Handle head bobbing when the player is moving horizontally.
            float playbackTime = player.Graphics.AnimationPlayer.PlaybackTime;
            if (!isPickingUp && Directions.IsHorizontal(player.Direction)
                && playbackTime >= 2 && playbackTime < 8) // TODO: magic number
            {
                carryObject.ZPosition -= 1;
            }

            // Draw the object.
            carryObject.Graphics.Draw(g, DepthLayer.ProjectileCarriedTile);
        }
Example #13
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------

        public RoomControl()
        {
            room         = null;
            dungeon      = null;
            roomLocation = Point2I.Zero;
            entities     = new List <Entity>();
            eventTiles   = new List <EventTile>();
            viewControl  = new ViewControl();
            tileManager  = new TileManager(this);
            roomGraphics = new RoomGraphics(this);
            roomPhysics  = new RoomPhysics(this);
            requestedTransitionDirection = 0;
            eventPlayerRespawn           = null;
            eventRoomTransitioning       = null;
            entityCount        = 0;
            entityIndexCounter = 0;
            isSideScrolling    = false;
        }
Example #14
0
        // Draw all tiles in the grid.
        public void DrawTiles(RoomGraphics g)
        {
            for (int i = 0; i < layerCount; i++)
            {
                for (int y = 0; y < GridHeight; y++)
                {
                    for (int x = 0; x < GridWidth; x++)
                    {
                        Tile t = tiles[x, y, i];

                        if (t != null && IsTileAtGridLocation(t, x, y))
                        {
                            t.Draw(g);

                            /*
                             * // DEBUG: draw grid cell occupance.
                             * Rectangle2F tileBounds = (Rectangle2F) t.TileGridArea;
                             * tileBounds.Point *= tileGridCellSize;
                             * tileBounds.Size *= tileGridCellSize;
                             * Color c = Color.Yellow;
                             * if (i == 1)
                             *      c = Color.Blue;
                             * else if (i == 2)
                             *      c = Color.Red;
                             * g.FillRectangle(tileBounds, c);
                             *
                             * tileBounds = new Rectangle2F(t.Position, t.Size * GameSettings.TILE_SIZE);
                             * c = Color.Olive;
                             * if (i == 1)
                             *      c = Color.Cyan;
                             * else if (i == 2)
                             *      c = Color.Maroon;
                             *
                             * g.DrawLine(new Line2F(tileBounds.TopLeft, tileBounds.BottomRight - new Point2I(1, 1)), 1, c);
                             * g.DrawLine(new Line2F(tileBounds.TopRight - new Point2I(1, 0), tileBounds.BottomLeft - new Point2I(0, 1)), 1, c);
                             * g.DrawRectangle(tileBounds, 1, Color.Black);
                             */
                        }
                    }
                }
            }
        }
Example #15
0
        public override void DrawOver(RoomGraphics g)
        {
            carryObject.Position  = player.Position + objectDrawOffset;
            carryObject.ZPosition = player.ZPosition + objectZOffset;
            if (!isPickingUp && Directions.IsHorizontal(player.Direction))
            {
                carryObject.ZPosition += 1;
            }

            // Handle head bobbing when the player is moving horizontally.
            float playbackTime = player.Graphics.AnimationPlayer.PlaybackTime;

            if (!isPickingUp && Directions.IsHorizontal(player.Direction) &&
                playbackTime >= 2 && playbackTime < 8)                    // TODO: magic number
            {
                carryObject.ZPosition -= 1;
            }

            // Draw the object.
            carryObject.Graphics.Draw(g, DepthLayer.ProjectileCarriedTile);
        }
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            // Draw 3 links between hook and player (alternating which one is visible).
            Vector2F hookStartPos = HookStartPosition;
            int      linkIndex    = (GameControl.RoomTicks % 3) + 1;
            float    percent      = (linkIndex / 4.0f);
            Vector2F linkPos      = Vector2F.Lerp(hookStartPos, position, percent);

            g.DrawSprite(GameData.SPR_SWITCH_HOOK_LINK,
                         linkPos - new Vector2F(0, zPosition), Graphics.DepthLayer);

            // Draw collectible over hook.
            if (collectible != null)
            {
                Vector2F pos = Center + Directions.ToVector(direction) * 4;
                collectible.SetPositionByCenter(pos);
                collectible.ZPosition = zPosition;
                collectible.Graphics.Draw(g, Graphics.CurrentDepthLayer);
            }
        }
Example #17
0
        public override void Draw(RoomGraphics g)
        {
            // Draw the extension bar.
            if (extendLength > 0.0f)
            {
                Sprite spr;
                if (Directions.IsHorizontal(direction))
                {
                    spr = GameData.SPR_TILE_PULL_HANDLE_BAR_HORIZONTAL;
                }
                else
                {
                    spr = GameData.SPR_TILE_PULL_HANDLE_BAR_VERTICAL;
                }

                for (float length = 0.0f; length < extendLength; length += GameSettings.TILE_SIZE)
                {
                    Vector2F drawPos = Position - Offset + (Directions.ToVector(direction) * (length + 8.0f));
                    g.DrawSprite(spr, drawPos, DepthLayer.TileLayer1);
                }
            }

            base.Draw(g);
        }
Example #18
0
 public virtual void DrawOver(RoomGraphics g)
 {
 }
Example #19
0
 public virtual void Draw(RoomGraphics g)
 {
     graphics.Draw(g);
 }
Example #20
0
 public override void DrawOver(RoomGraphics g)
 {
     // Draw the flame effect.
     g.DrawAnimationPlayer(flameAnimationPlayer, monster.Center -
                           new Vector2F(0, monster.ZPosition), DepthLayer.EffectMonsterBurnFlame);
 }
Example #21
0
 public override void Draw(RoomGraphics g)
 {
     state.DrawUnder(g);
     base.Draw(g);
     state.DrawOver(g);
 }
 public override void DrawOver(RoomGraphics g)
 {
     if (isSwitching) {
         hookedEntity.Graphics.Draw(g, DepthLayer.RisingTile);
     }
 }
Example #23
0
 public virtual void DrawUnder(RoomGraphics g)
 {
 }
Example #24
0
        public override void Draw(RoomGraphics g)
        {
            state.DrawUnder(g);
            if (specialState != null && specialState.IsActive)
                specialState.DrawUnder(g);

            base.Draw(g);

            state.DrawOver(g);
            if (specialState != null && specialState.IsActive)
                specialState.DrawOver(g);
        }
Example #25
0
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            g.DrawSprite(GameData.SPR_TILE_STATUE_EYE, Position + eyeOffset, DepthLayer.TileLayer1);
        }
Example #26
0
        public override void Draw(RoomGraphics g)
        {
            DepthLayer depthLayer = Graphics.CurrentDepthLayer;

            // Draw tools under.
            foreach (UnitTool tool in tools) {
                if (!tool.DrawAboveUnit) {
                    Vector2F drawPosition = position - new Vector2F(0, zPosition) + Graphics.DrawOffset + tool.DrawOffset;
                    g.DrawAnimationPlayer(tool.AnimationPlayer, tool.ImageVariantID, drawPosition, depthLayer, position);
                }
            }

            // Draw entity.
            base.Draw(g);

            // Draw tools over.
            foreach (UnitTool tool in tools) {
                if (tool.DrawAboveUnit) {
                    Vector2F drawPosition = position - new Vector2F(0, zPosition) + Graphics.DrawOffset + tool.DrawOffset;
                    g.DrawAnimationPlayer(tool.AnimationPlayer, tool.ImageVariantID, drawPosition, depthLayer, position);
                }
            }
        }
        public override void Draw(RoomGraphics g)
        {
            base.Draw(g);

            // Draw 3 links between hook and player (alternating which one is visible).
            Vector2F hookStartPos = HookStartPosition;
            int linkIndex = (GameControl.RoomTicks % 3) + 1;
            float percent = (linkIndex / 4.0f);
            Vector2F linkPos = Vector2F.Lerp(hookStartPos, position, percent);
            g.DrawSprite(GameData.SPR_SWITCH_HOOK_LINK,
                linkPos - new Vector2F(0, zPosition), Graphics.DepthLayer);

            // Draw collectible over hook.
            if (collectible != null) {
                Vector2F pos = Center + Directions.ToVector(direction) * 4;
                collectible.SetPositionByCenter(pos);
                collectible.ZPosition = zPosition;
                collectible.Graphics.Draw(g, Graphics.CurrentDepthLayer);
            }
        }
Example #28
0
 public override void DrawUnder(RoomGraphics g)
 {
     // Draw the minecart below the player.
     g.DrawAnimationPlayer(minecartAnimationPlayer,
         player.Center - new Vector2F(8, 8) - playerOffset, DepthLayer.PlayerAndNPCs);
 }
 public override void DrawUnder(RoomGraphics g)
 {
     // Draw the minecart below the player.
     g.DrawAnimationPlayer(minecartAnimationPlayer,
         player.Center - new Vector2F(8, 8) - playerOffset, DepthLayer.PlayerAndNPCs);
 }
Example #30
0
 public override void Draw(RoomGraphics g)
 {
     state.DrawUnder(g);
     base.Draw(g);
     state.DrawOver(g);
 }
 public override void DrawOver(RoomGraphics g)
 {
     // Draw the flame effect.
     g.DrawAnimationPlayer(flameAnimationPlayer, monster.Center -
         new Vector2F(0, monster.ZPosition), DepthLayer.EffectMonsterBurnFlame);
 }