/// <summary> /// Called when New Game is clicked /// </summary> public World(GameForm gf,string mapname) { Player = new Tower_Defense.Player(); Gameform = gf; Map = new Level(mapname); UIElements.Add(new Button("Next Wave", gf.Width - 425, 5,150,50)); UIElements.Add(new Button("Pause Game", gf.Width - 275, 5,150,50)); UIElements.Add(new Button("Exit", gf.Width - 125, 5, 100, 50)); UIElements.Add(new Button("Speed", gf.Width - 575, 5, 150, 50)); BuildMenu = new Tower_Defense.BuildMenu(); BuildMenu.initMenu((int)(gf.Width / 1.31), 75, gf); }
public static bool Contains(System.Drawing.Rectangle rect, Level.MapTile point) { if (rect.Top < point.ScreenSprite.Top && rect.Bottom > point.ScreenSprite.Bottom && rect.Left < point.ScreenSprite.Left && rect.Right > point.ScreenSprite.Right) return true; return false; }
public void initMob(Level map) { this.Map = map; var pathnum = Helper.random.Next(map.Starts.Count()); this.WorldX = map.Starts[pathnum].X; this.WorldY = map.Starts[pathnum].Y; this.path = map.buildPath(map.Starts[pathnum]); }
public Monster(short TextureIndex, Level map, int width = 0, int height = 0) : base(TextureIndex, 0, 0, width, height) { Type = ObjectType.Monster; _hits = _baseHitsAfterLevel; }
private void BuildTower(Level.MapTile m) { if (World.Player.Gold < TowerToBuild.Cost || m.Type != Level.MapTileType.EmptyTile) { TowerToBuild = null; return; } World.Player.Gold -= TowerToBuild.Cost; m.Type = Level.MapTileType.TowerHere; Tower t = TowerToBuild; t.WorldX = m.WorldX; t.WorldY = m.WorldY; World.DrawableObjects.Add(t); TowerToBuild = null; }