public EndScreen(PlayerIndex playerIndex, Color color) { Sprite bg = new Sprite(); bg.LoadTexture(@"Assets/HeartBG"); bg.Scale /= Controller.CurrentDrawCamera.zoom; this.AddChild(bg); heart = new Sprite(); heart.LoadTexture(@"Assets/Heart"); heart.Scale /= (Controller.CurrentDrawCamera.zoom * 1.1f); heart.Position.X += 110; this.AddChild(heart); slime = new Sprite(); slime.LoadTexture(@"Assets/HeartSlime"); slime.Scale /= (Controller.CurrentDrawCamera.zoom * 1.1f); slime.Position.X += 110; slime.Color = color; this.AddChild(slime); Label lbl = new Label("Player " + (float)(playerIndex + 1) + " has won!", Controller.FontController.GetFont("bigFont")); lbl.Position.X = ((Controller.ScreenSize.X / Controller.CurrentDrawCamera.zoom) / 2) - (lbl.Width / 2); AddChild(lbl); Label lblAdvance = new Label("Press A to apply CPR", Controller.FontController.GetFont("bigFont")); lblAdvance.Position.X = ((Controller.ScreenSize.X / Controller.CurrentDrawCamera.zoom) / 2) - (lblAdvance.Width / 2); lblAdvance.Position.Y = 550; AddChild(lblAdvance); ECGsound = Controller.Content.Load<SoundEffect>("sounds/ecg"); }
public MenuState() { scaleTimer = scaleTime; Sprite bg = new Sprite(); bg.LoadTexture(@"Assets/HeartBG"); bg.Scale /= Controller.CurrentDrawCamera.zoom; this.AddChild(bg); heart = new Sprite(); heart.LoadTexture(@"Assets/Heart"); heart.Scale /= (Controller.CurrentDrawCamera.zoom * 1.1f); heart.Position.X += 110; this.AddChild(heart); Sprite logo = new Sprite(); logo.LoadTexture(@"Assets/logo"); logo.Position.X = 300; logo.Position.Y = 20; logo.Scale *= 0.7f; this.AddChild(logo); controls = new Sprite(); controls.LoadTexture(@"Assets/Controlls"); controls.Scale /= Controller.CurrentDrawCamera.zoom; controls.Deactivate(); this.AddChild(controls); Sprite controllsMessage = new Sprite(); controllsMessage.LoadTexture(@"Assets/smallStartMessage"); controllsMessage.Position.X = (1024 / Controller.CurrentDrawCamera.zoom) - (300 / Controller.CurrentDrawCamera.zoom); controllsMessage.Position.Y = (768 / Controller.CurrentDrawCamera.zoom) - (96 / Controller.CurrentDrawCamera.zoom) - (150 / Controller.CurrentDrawCamera.zoom); controllsMessage.Scale /= Controller.CurrentDrawCamera.zoom; this.AddChild(controllsMessage); Sprite backgroundBehindPlayer = new Sprite(); backgroundBehindPlayer.LoadTexture(@"Assets/HudBG"); backgroundBehindPlayer.Position = new Vector2(0, (768 / Controller.CurrentDrawCamera.zoom) - (96 / Controller.CurrentDrawCamera.zoom)); backgroundBehindPlayer.Scale /= Controller.CurrentDrawCamera.zoom; this.AddChild(backgroundBehindPlayer); player = new Sprite[4]; for (int i = 0; i < 4; i++) { player[i] = new Sprite(); player[i].LoadTexture(Controller.Content.Load<Texture2D>("images/slimeblobOther"), 48, 48); player[i].Scale /= Controller.CurrentDrawCamera.zoom; player[i].AddAnimation("IDLE", new int[1] { 0 }, 0); player[i].Color = playerData.ElementAt(i).Key; player[i].Position = playerData.ElementAt(i).Value; this.AddChild(player[i]); } for(int k = 0; k < 4; k++) { label[k] = new Label("", Controller.FontController.GetFont("DefaultFont")); label[k].Position = player[k].Position + new Vector2(-45, 100); label[k].Scale /= Controller.CurrentDrawCamera.zoom - 0.2f; this.AddChild(label[k]); } labelPlayerindication[0] = new Label("P1: ", Controller.FontController.GetFont("DefaultFont")); labelPlayerindication[0].Position = player[0].Position - new Vector2(60, -30); labelPlayerindication[0].Scale /= Controller.CurrentDrawCamera.zoom - 0.3f; labelPlayerindication[1] = new Label("P2: ", Controller.FontController.GetFont("DefaultFont")); labelPlayerindication[1].Position = player[1].Position - new Vector2(60, -30); labelPlayerindication[1].Scale /= Controller.CurrentDrawCamera.zoom - 0.3f; labelPlayerindication[2] = new Label("P3: ", Controller.FontController.GetFont("DefaultFont")); labelPlayerindication[2].Position = player[2].Position - new Vector2(60, -30); labelPlayerindication[2].Scale /= Controller.CurrentDrawCamera.zoom - 0.3f; labelPlayerindication[3] = new Label("P4: ", Controller.FontController.GetFont("DefaultFont")); labelPlayerindication[3].Position = player[3].Position - new Vector2(60, -30); labelPlayerindication[3].Scale /= Controller.CurrentDrawCamera.zoom - 0.3f; for (int l = 0; l < 4; l++) { this.AddChild(labelPlayerindication[l]); } }
public GameState() { this.BigText = new Label("Player 1 is out", Controller.FontController.GetFont("bigFont")); this.BigText.HorizontalAlign = HorizontalAlign.CENTER; this.BigText.Visable = false; this.BigText.Width = 1800; this.BigText.Height = 1000; Controller.LayerController.AddLayer("bombLayer"); FatBomb.state = this; Vetbol.state = this; CapturePoint.state = this; TiledSprite bg = new TiledSprite(2000, 2000); bg.LoadTexture("background"); bg.Depth = 0f; tilemap = new Tilemap(); tilemap.LoadMap("Content/testmap.tmx", 32, 32); this.AddChild(bg); this.AddChild(tilemap); this.players = new List<Vetbol>(); playerSpawn = tilemap.RemoveTiles(7); int playerRespawn = rnd.Next(playerSpawn.Count); List<Tile> capturePointTiles = tilemap.RemoveTiles(3); foreach (Tile tile in capturePointTiles) { CapturePoint capturepoint = new CapturePoint(); capturepoint.Position = tile.Position + ( new Vector2(-27, -61)); capturePoints.Add(capturepoint); AddChild(capturepoint); } NotUsedSpawnPoints = new List<Tile>(); NotUsedSpawnPoints.AddRange(playerSpawn); for (int i = 0; i < Controller.Input.getPadStateList.Where(c => c.IsConnected).Count(); i++) { this.players.Add(new Vetbol((PlayerIndex)i)); } for (int j = 0; j < players.Count; j++) { this.players[j].score = playerStartScore; this.players[j].Position = this.getAvailablePosition(); this.AddChild(this.players[j]); } lastPlayerAlive = players[0]; this.BombPool = new Pool<FatBomb>(50, false, FatBomb.IsValid, this.NewBomb); soundEffectBomb = Controller.Content.Load<SoundEffect>("sounds/explode"); this.AddChild(this.BigText); this.hud = new HUD(this.players, respawnTime); this.AddChild(hud); deadSound = Controller.Content.Load<SoundEffect>("sounds/dead"); ECGsound = Controller.Content.Load<SoundEffect>("sounds/ecg"); }
public PlayerHUDStatus(Vector2 size, Vetbol player, TimeSpan timer) { this.size = size; this.player = player; playerImage = new Sprite(); playerFrame = new Sprite(); playerFrame.Position.X = (size.X / 2) -((96 / Controller.CurrentDrawCamera.zoom) / 2) + (float)player.index * size.X; playerFrame.Position.Y = this.Position.Y; playerFrame.Scale /= Controller.CurrentDrawCamera.zoom; playerImage.Position.X = playerFrame.Position.X + ((96 - 20) / 2) - (playerImage.Width / 2); playerImage.Position.Y = this.Position.Y + ((96 - 65) / 2); playerImage.Scale /= Controller.CurrentDrawCamera.zoom; playerFrame.LoadTexture(Controller.Content.Load<Texture2D>(@"Assets/peter4croisants"), 96, 96); playerFrame.AddAnimation("IDLE", new int[1] { 0 }, 0); playerFrame.AddAnimation("LOADING", new int[12] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, (float)timer.TotalSeconds / 12); this.playerImage.LoadTexture(Controller.Content.Load < Texture2D >(@"images/slimeblobOther"), 48, 48); this.playerImage.Color = player.image.Color; this.playerTickets = new Label(player.score.ToString(), Controller.FontController.GetFont("DefaultFont")); this.playerTickets.Position = new Vector2(playerImage.Position.X + 10, this.Position.Y + 115); this.playerTickets.Scale /= Controller.CurrentDrawCamera.zoom - 0.3f; this.AddChild(playerFrame); this.AddChild(playerImage); this.AddChild(playerTickets); }