PointF Velocity; //Stores the Horizontal and Vertical components of its velocity #endregion Fields #region Constructors public WumpusDisk(Player ToHit, PointF InitialPosition, float Rotation) : base("WumpusDisk" + Count, "Disk1.png", 32, 32) { Count++; //Increase the count of the number of arrows we have made ZOrder = 10; //Arrows appear in front of everything else. this.Position = new PointF(InitialPosition.X, InitialPosition.Y); this.ToHit = ToHit; Velocity = new PointF(InitialSpeed * (float)Math.Cos((Math.PI / 180.0f) * this.Rotation), InitialSpeed * (float)Math.Sin((Math.PI / 180.0f) * this.Rotation)); //Send the arrow along the correct path Collision = CollisionTypes.Rectangular; CollisionBox = new PointF(16, 16); RemoveFrame(0); AddFrame("WDisk\\WDisk1.png", 4); AddFrame("WDisk\\WDisk2.png", 4); AddFrame("WDisk\\WDisk3.png", 4); AddFrame("WDisk\\WDisk4.png", 4); AddFrame("WDisk\\WDisk5.png", 4); AddFrame("WDisk\\WDisk6.png", 4); AddFrame("WDisk\\WDisk7.png", 4); AddFrame("WDisk\\WDisk8.png", 4); GoToFrame(0); AnimateForwards(); }
public Wumpus(Player p) : base("Wumpus", "Wumpus.png", 128, 128) { Position = new PointFHelp.PointF(0, 0); ToTrack = p; Collision = CollisionTypes.Rectangular; //Enable the collision CollisionBox = new PointFHelp.PointF(Width, Height); ShootTimer = SecondsPerShoot * 60; }
uint InvincibilityTimer = 60; //This is used to ensure that there is a 1 second time period in which this enemy cannot attack again #endregion Fields #region Constructors public Enemy(Player p) : base("Enemy" + Counter, "Enemy.png", 64, 64) { Position = new PointF(Rand.Next((int)(-Game.Dimensions.X / 2 + 128), (int)(Game.Dimensions.X / 2 - 128)), Rand.Next((int)(-Game.Dimensions.Y / 2 + 128), (int)(Game.Dimensions.Y / 2 - 128))); //Spawn the enemy in a random location ToTrack = p; //Assign the player to be tracked Collision = CollisionTypes.Rectangular; //Enable the collision CollisionBox = new PointF(Width, Height); Counter++; SetFrameDuration(0, 60); //Set the default picture to be 60 frames long AddFrame("Enemy2.png", 60); //Add another picture and set that to be 60 frames long GoToFrame(0); //Go to the first frame AnimateForwards(); //Begin animation }
public Bat(Player p) : base("Bat" + Count, "Bat 1.png", 128, 64) { Position = new PointF(Rand.Next((int)(-Game.Dimensions.X / 2 + 128), (int)(Game.Dimensions.X / 2 - 128)), Rand.Next((int)(-Game.Dimensions.Y / 2 + 128), (int)(Game.Dimensions.Y / 2 - 128))); //Spawn the enemy in a random location Count++; ToTrack = p; //Assign the player to be tracked Collision = CollisionTypes.Rectangular; //Enable the collision CollisionBox = new PointF(Width, Height); RemoveFrame(0); AddFrame("Bat 1.png", 6); AddFrame("Bat 2.png", 6); GoToFrame(0); AnimateForwards(); }
public Arm(Player p, int ControllerIndex) : base("Arm", "Arm1.png", 64, 128) { P = p; Controller = XboxController.RetrieveController(ControllerIndex); ReadyToFire = true; RemoveFrame(0); AddFrame("Arm\\Arm1.png", 4); AddFrame("Arm\\Arm2.png", 4); AddFrame("Arm\\Arm3.png", 4); AddFrame("Arm\\Arm4.png", 4); AddFrame("Arm\\Arm5.png", 4); AddFrame("Arm\\Arm6.png", 4); AddFrame("Arm\\Arm7.png", 4); AddFrame("Arm\\Arm8.png", 4); GoToFrame(0); AnimateForwards(); }
public override void Initialize() { base.Initialize(); MusicTimer = RegularMusicDuration * (int)FrameRateController.FrameRate; RegularMusic.Play(); Music = false; Game.RoomMessage.Visible = true; Game.LifeCounter.Visible = true; Game.DiskCounter.Visible = true; GameObject Background = new GameObject("Background", "GameBackground2.jpg", 1366, 768); Background.AddFrame("PitBackground.jpg", 0); Background.ZOrder = -10; ObjectManager.AddGameObject(Background); GameObject LifeIcon = new GameObject("LifeIcon", "LifeIcon.png", 64, 64); LifeIcon.Position = new PointFHelp.PointF(-619, 320); LifeIcon.ZOrder = 10; ObjectManager.AddGameObject(LifeIcon); GameObject DiskIcon = new GameObject("DiskIcon", "DiskIcon.png", 64, 64); DiskIcon.Position = new PointFHelp.PointF(-619, 256); DiskIcon.ZOrder = 10; ObjectManager.AddGameObject(DiskIcon); ThePlayer = new Player(); ObjectManager.AddGameObject(ThePlayer); //Create the player ObjectManager.AddGameObject(new Arm(ThePlayer, 0)); //Add the arm that follows the player //Create the walls NWalls = new Wall[4]; NEWalls = new Wall[3]; SEWalls = new Wall[3]; SWalls = new Wall[4]; SWWalls = new Wall[3]; NWWalls = new Wall[3]; for (int i = 0; i < NWalls.Length; i++) { NWalls[i] = new Wall("NWall" + i); ObjectManager.AddGameObject(NWalls[i]); NWalls[i].Position.Y = 320; NWalls[i].Position.X = (128 * i) - 256; NWalls[i].Collidable = true; } for (int i = 0; i < NEWalls.Length; i++) { NEWalls[i] = new Wall("NEWall" + i); ObjectManager.AddGameObject(NEWalls[i]); NEWalls[i].Position.Y = 320 - (i * 128); NEWalls[i].Position.X = (128 * i) + 256; NEWalls[i].Collidable = true; } for (int i = 0; i < SEWalls.Length; i++) { SEWalls[i] = new Wall("SEWall" + i); ObjectManager.AddGameObject(SEWalls[i]); SEWalls[i].Position.Y = -320 + (i * 128); SEWalls[i].Position.X = (128 * i) + 256; SEWalls[i].Collidable = true; } for (int i = 0; i < SWalls.Length; i++) { SWalls[i] = new Wall("SWall" + i); ObjectManager.AddGameObject(SWalls[i]); SWalls[i].Position.Y = -320; SWalls[i].Position.X = (128 * i) - 256; SWalls[i].Collidable = true; } for (int i = 0; i < SWWalls.Length; i++) { SWWalls[i] = new Wall("SWWall" + i); ObjectManager.AddGameObject(SWWalls[i]); SWWalls[i].Position.Y = -320 + (i * 128); SWWalls[i].Position.X = (-128 * i) - 256; SWWalls[i].Collidable = true; } for (int i = 0; i < NWWalls.Length; i++) { NWWalls[i] = new Wall("NWWall" + i); ObjectManager.AddGameObject(NWWalls[i]); NWWalls[i].Position.Y = 320 - (i * 128); NWWalls[i].Position.X = (-128 * i) - 256; NWWalls[i].Collidable = true; } EdgeWalls = new Wall[4]; for (int i = 0; i < EdgeWalls.Length; i++) { EdgeWalls[i] = new Wall("EdgeWall" + i); EdgeWalls[i].Collidable = true; EdgeWalls[i].CollisionBox = new PointF(128, 128); ObjectManager.AddGameObject(EdgeWalls[i]); } EdgeWalls[0].Position = new PointF(619, 64); EdgeWalls[1].Position = new PointF(619, -64); EdgeWalls[2].Position = new PointF(-619, 64); EdgeWalls[3].Position = new PointF(-619, -64); ThePlayer.NWalls = NWalls; ThePlayer.NEWalls = NEWalls; ThePlayer.SEWalls = SEWalls; ThePlayer.SWalls = SWalls; ThePlayer.SWWalls = SWWalls; ThePlayer.NWWalls = NWWalls; ThePlayer.EdgeWalls = EdgeWalls; }