private void InitMaps() { BrownRockMap = new TileMaskMap(Cells.Map(p => p == ImageCellType.BrownRock), GameTiles.BrownRock()); GrassMap = new TileMaskMap(Cells.Map(p => p == ImageCellType.GrassBackground), GameTiles.Grass()); WaterMap = new TileMaskMap(Cells.Map(p => p == ImageCellType.Water), GameTiles.Water()); LadderMap = new TileMaskMap(Cells.Map(p => p == ImageCellType.Ladder), GameTiles.Ladder()); }
public Interface(QuickGameScene scene) { Scene = scene; var screen = Engine.GetScreenBoundary().Position; var tileset = GameTiles.Border(); border = new BorderedRectangle(tileset, new Rectangle(0, 0, screen.Width.SnapTo(tileset.Texture.CellSize.X), 30.SnapTo(tileset.Texture.CellSize.Y)), scene.InterfaceLayer); hearts = new IconCounter(scene.Player.DamageHandler.Hitpoints.GetMax(), Textures.HeartTexture, 0, 1, 2, scene.InterfaceLayer); hearts.Position.SetCorner(8, 4); ScoreLabel = new DynamicText <King>(scene.Player, p => "SCORE: " + p.Score.ToString("000000"), Fonts.SmallFont, scene.InterfaceLayer); ScoreLabel.DockInside(border, BorderSide.Right).Nudge(-4, 0); scene.AddObject(this); }
public PauseHandler() { var scene = QuickGameScene.Current; scene.AddObject(this); pauseInputCondition = new InputCondition(GameKeys.Start, Input.GetInput(scene)); foreach (var group in scene.UpdateGroups) { if (group.Priority != UpdatePriority.ModalMenu && group.Priority != UpdatePriority.Input) { group.AddPauseCondition(IsPaused); } } pauseMenu = new LayoutPanel(GameTiles.Border(), scene.InterfaceLayer); pauseMenu.AddItem(new GameText(Fonts.BigFont, "PAUSED", scene.InterfaceLayer)); pauseMenu.AddItem(new DynamicText <King>(scene.Player, p => "COINS: " + p.Coins, Fonts.BigFont, scene.InterfaceLayer)); pauseMenu.Position.Center = Engine.GetScreenSize().Center; pauseMenu.Visible = false; }
public static QuickGameTileMap Create(QuickGameScene scene) { var masterMap = scene.MasterTemplate; var template = masterMap.Extract(scene.ID.MapNumber); CalculateObscuredTiles(template.Cells, template.GrassMap); CalculateObscuredTiles(template.Cells, template.WaterMap); ExtendTileMask(template.GrassMap); ExtendTileMask(template.WaterMap); var solidTiles = new QuickGameTileMap(scene.SolidLayer, template.BrownRockMap.TileSet.Texture, template.Cells.Size); solidTiles.EmptyCell = template.BrownRockMap.TileSet.GetCell(BorderSide.EmptySpace); template.BrownRockMap.Apply(solidTiles); template.LadderMap.Apply(solidTiles, applyEmptyCells: false); var grassTiles = new QuickGameTileMap(scene.SolidLayer, template.GrassMap.TileSet.Texture, template.Cells.Size); template.GrassMap.Apply(grassTiles); var waterTiles = new QuickGameTileMap(scene.WaterLayer, template.BrownRockMap.TileSet.Texture, template.Cells.Size); waterTiles.EmptyCell = solidTiles.EmptyCell; template.WaterMap.Apply(waterTiles, true); FixWaterSurfaceTiles(waterTiles, template.WaterMap.TileSet); scene.WaterLayer.FixedDisplayable = new IDisplayable[] { waterTiles }; scene.SolidLayer.FixedDisplayable = new IDisplayable[] { grassTiles, solidTiles }; List <MovingBlockPiece> movingBlockPieces = new List <MovingBlockPiece>(); List <PathPoint> pathPoints = new List <PathPoint>(); foreach (var point in template.Cells.Points) { if (template.Cells.GetFromPoint(point) == ImageCellType.PlayerStart) { scene.PlayerStart = new Vector2(point.X * 16, point.Y * 16); } else if (template.Cells.GetFromPoint(point) == ImageCellType.Spike) { solidTiles.Tiles.Cells.Set(point, solidTiles.Tiles.Texture.PointToIndex(3, 7)); } else if (template.Cells.GetFromPoint(point) == ImageCellType.Spring) { solidTiles.Tiles.Cells.Set(point, solidTiles.Tiles.Texture.PointToIndex(4, 2)); } else if (template.Cells.GetFromPoint(point) == ImageCellType.BreakableBlock) { solidTiles.Tiles.Cells.Set(point, solidTiles.Tiles.Texture.PointToIndex(1, 7)); } else if (template.Cells.GetFromPoint(point) == ImageCellType.Box) { new Box().SetPosition(point.X * 16, point.Y * 16); } else if (template.Cells.GetFromPoint(point) == ImageCellType.MovingBlock) { movingBlockPieces.Add(new MovingBlockPiece(point, solidTiles.Tiles.Texture.CellSize)); } else if (template.Cells.GetFromPoint(point) == ImageCellType.Path) { pathPoints.Add(new PathPoint((int)point.X * 16, (int)point.Y * 16)); } } MovingBlockFactory.CreateBlocks(scene, movingBlockPieces, pathPoints); var agt = GameTiles.AutoGenTiles(); agt.Apply(solidTiles); return(solidTiles); }
public ShopMenu(QuickGameScene scene) : base(scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(scene), new MenuKeys { Select = GameKeys.MenuOK, Cancel = GameKeys.Start }) { MenuPanel.AddItem(new GameText(Fonts.SmallFont, "WELCOME!", scene.InterfaceLayer)); MenuPanel.AddItem(new DynamicText <King>(scene.Player, p => "COINS: " + p.Coins, Fonts.SmallFont, scene.InterfaceLayer)); AddOption(new ExtraHeartShopItem() { Player = scene.Player, MenuPanel = MenuPanel }); AddOption(new BetterAttackShopItem() { Player = scene.Player, MenuPanel = MenuPanel }); AddOption(new ExitShopOption() { Player = scene.Player, MenuPanel = MenuPanel }); }
public ItemSelector(QuickGameScene Scene, LiveEditor editor) : base(Scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(Scene), new MenuKeys { Select = GameKeys.MenuOK, Cancel = GameKeys.EditorMenu }) { foreach (var cellType in EnumHelper.GetValues <CellType>().Where(p => p != CellType.Empty)) { AddOption(new EditorItem() { ItemType = cellType, Editor = editor }); } }
public EditorMenu(QuickGameScene Scene, LiveEditor editor) : base(Scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(Scene), new MenuKeys { Select = GameKeys.MenuOK, Cancel = GameKeys.EditorMenu }) { AddOption(new ItemsOption() { Editor = editor }); AddOption(new FreezeItemsOption(Scene) { Editor = editor }); AddOption(new ReloadOption(Scene) { Editor = editor }); AddOption(new SaveLevelOption() { Editor = editor }); AddOption(new CancelOption() { Editor = editor }); }