public void handleControls() { try { if (!Gui.emoteMenuOpen) { if (Input.isKeyTap(Keyboard.Key.Num1)) { weapon = weapons[0]; MainGame.dm.Mailman.sendWeaponSwitch(0); } if (Input.isKeyTap(Keyboard.Key.Num2)) { if (weapons[1] != null) { weapon = weapons[1]; MainGame.dm.Mailman.sendWeaponSwitch(1); } } if (Input.isKeyTap(Keyboard.Key.Num3)) { if (weapons[2] != null) { weapon = weapons[2]; MainGame.dm.Mailman.sendWeaponSwitch(2); } } if (Input.isKeyTap(Keyboard.Key.Num4)) { if (weapons[3] != null) { weapon = weapons[3]; MainGame.dm.Mailman.sendWeaponSwitch(3); } } } } catch (Exception) { } ItemTimer--; if (Input.isKeyTap(Keyboard.Key.E)) { if (OnGround && ItemTimer <= 0) { ItemTimer = (40 * 60); switch (ItemType) { case 1: MainGame.dm.Mailman.SendLandMineCreate(MainGame.rand.Next(100000), this.Pos, this.UID); break; case 2: MainGame.dm.Mailman.SendGeneratorCreate(1, this.Pos); break; case 3: MainGame.dm.Mailman.SendGeneratorCreate(2, this.Pos); break; } } } if (Mouse.IsButtonPressed(Mouse.Button.Right)) { CrosshairCameraRatio = 1f; dm.PlayerAimSphereRadius = 175f; } else { CrosshairCameraRatio = .5f; dm.PlayerAimSphereRadius = 100f; } //Right click zooming? Kinda cool maybe I dunno AimAngle = Helper.angleBetween(MainGame.worldMousePos, Core); if (Input.isKeyTap(Keyboard.Key.R)) { weapon.Reload(); } if (!weapon.AutomaticFire) if (Input.isMouseButtonTap(Mouse.Button.Left)) { weapon.Fire(); } if (weapon.AutomaticFire) { if (Mouse.IsButtonPressed(Mouse.Button.Left)) { weapon.Fire(); } } if (Input.isKeyTap(Keyboard.Key.W) || Input.isKeyTap(Keyboard.Key.Space)) { if (OnGround || (JumpsLeft > 0)) // && Velocity.Y > 0)) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("jump.wav"), 1, .3f, 25)); TrainDust td = new TrainDust(this.Pos, 0, 1f); td.Alpha = 1; dm.GameObjects.Add(td); JumpsLeft--; Vector2f nextVec = new Vector2f(0, -10f); this.Velocity = nextVec; } } if (Input.isKeyDown(Keyboard.Key.A)) { this.Velocity.X -= Speed; } SoftDrop = Input.isKeyDown(Keyboard.Key.S); bool downKey = Input.isKeyTap(Keyboard.Key.S); if (downKey) { Velocity.Y = 10; } if (Input.isKeyDown(Keyboard.Key.D)) { this.Velocity.X += Speed; } Facing = 1; if (MainGame.worldMousePos.X < MainGame.dm.player.Pos.X) { Facing = -1; } if (Input.isKeyDown(Keyboard.Key.Q) && dm.devMode) { DropMoney(MainGame.rand.Next(8, 16)); } if (Input.isKeyTap(Keyboard.Key.R) && dm.devMode) { dm.GameObjects.Add(new TreasureBox(this.Pos)); } }
public override void Update() { base.Update(); shittyTimerDontUse++; roundStarted = true; //Console.WriteLine(roundTimeLeft); if (roundTimeLeft % 60 == 0 && !tunnel) { tunnel = true; tunnelsTimer = 3; } if (roundTimeLeft < 15 && !resetMatch) { resetMatch = true; player.gold = 100; player.weapons = new List <Weapon>() { new Revolver(player), null, null, null, }; player.weapon = player.weapons[0]; MainGame.dm.Mailman.sendWeaponSwitch(0); for (int i = 0; i < GameObjects.Count; i++) { if (GameObjects[i] is Coin) { GameObjects.RemoveAt(i); } } } if (roundTimeLeft > 15) { firstPlacePlayer = MainGame.dm.Players.OrderByDescending(x => x.gold).ThenBy(x => (int)x.UID).ToList()[0]; resetMatch = false; } if (Input.isKeyDown(Keyboard.Key.F1)) { player.gold = 10000; player.MaxJumps = 10000000; player.Health = 1000000; } if (Input.isKeyOverride(Keyboard.Key.F12)) { devMode = true; player.MaxJumps = 10000; player.JumpsLeft = 10000; } if (tunnelsTimer > 0) { if (shittyTimerDontUse % (60 * 2) == 0) { if (!tunnel) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("TrainWhistle.wav"), 1, 0, 8)); } //if (Input.isKeyTap(Keyboard.Key.C)) //{ tunnelsTimer--; CliffFace c = new CliffFace(); BackgroundGameObjects.Add(c); } } //if (Input.isKeyTap(Keyboard.Key.C)) //{ // tunnelsTimer = 5; //} if (Input.isKeyTap(Keyboard.Key.T)) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("fart.wav"), 0, 1)); } tunnel = false; Mailman.HandleMessages(); Players.ForEach(p => { p.Update(); }); Projectiles.ForEach(p => { p.Update(); }); GameObjects.ForEach(p => { p.Update(); }); BackgroundGameObjects.ForEach(p => { p.Update(); }); CheckProjectileCollisions(); ApplyShake(); if (MainGame.rand.Next(4) == 0) { for (int i = 0; i < 5; i++) { GameObjects.Add(new TrainDust(new Vector2f(60 + (i * 440) + MainGame.rand.Next(70), 215), (float)MainGame.rand.NextDouble() * 90)); GameObjects.Add(new TrainDust(new Vector2f(304 + (i * 440) + MainGame.rand.Next(70), 215), (float)MainGame.rand.NextDouble() * 90)); } } TrainDust td = new TrainDust(new Vector2f(2190 + MainGame.rand.Next(10), 75), (float)MainGame.rand.NextDouble() * 90, 2); GameObjects.Add(td); GameObjects.Add(new TrainDust(new Vector2f(1978 + MainGame.rand.Next(10), 75), (float)MainGame.rand.NextDouble() * 90, 1)); if (Input.isKeyTap(Keyboard.Key.LShift) && !player.Alive) { if (player.respawnTimer <= 0) { //Players.Remove(player); //player = new ClientPlayer(this); //Players.Add(player); player.deathTimer = 0; player.respawnTimer = player.respawnLength * 60; player.Pos = new Vector2f(42 + MainGame.rand.Next(1000), 142); player.Health = 100; player.Alive = true; } //player.Pos = new Vector2f(MainGame.rand.Next(42,1800), 142); //Mailman.SendRespawn(player.UID); } if (Input.isKeyDown(Keyboard.Key.P)) { Console.WriteLine(player.Pos); } if (Input.isKeyDown(Keyboard.Key.R)) { MainGame.Camera.Center += new Vector2f(MainGame.rand.Next(-4, 5) * shakeFactor / 5, MainGame.rand.Next(-4, 5) * shakeFactor / 5); } trainSound.Update(); Gui.Update(); }
public override void Update() { base.Update(); shittyTimerDontUse++; roundStarted = true; //Console.WriteLine(roundTimeLeft); if (roundTimeLeft % 60 == 0 && !tunnel) { tunnel = true; tunnelsTimer = 3; } if (roundTimeLeft < 15 && !resetMatch) { resetMatch = true; player.gold = 100; player.weapons = new List<Weapon>() { new Revolver(player), null, null, null, }; player.weapon = player.weapons[0]; MainGame.dm.Mailman.sendWeaponSwitch(0); for (int i = 0; i < GameObjects.Count; i++) { if (GameObjects[i] is Coin) GameObjects.RemoveAt(i); } } if (roundTimeLeft > 15) { firstPlacePlayer = MainGame.dm.Players.OrderByDescending(x => x.gold).ThenBy(x => (int)x.UID).ToList()[0]; resetMatch = false; } if (Input.isKeyDown(Keyboard.Key.F1)) { player.gold = 10000; player.MaxJumps = 10000000; player.Health = 1000000; } if (Input.isKeyOverride(Keyboard.Key.F12)) { devMode = true; player.MaxJumps = 10000; player.JumpsLeft = 10000; } if (tunnelsTimer > 0) if (shittyTimerDontUse % (60 * 2) == 0) { if (!tunnel) MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("TrainWhistle.wav"), 1, 0, 8)); //if (Input.isKeyTap(Keyboard.Key.C)) //{ tunnelsTimer--; CliffFace c = new CliffFace(); BackgroundGameObjects.Add(c); } //if (Input.isKeyTap(Keyboard.Key.C)) //{ // tunnelsTimer = 5; //} if (Input.isKeyTap(Keyboard.Key.T)) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("fart.wav"), 0, 1)); } tunnel = false; Mailman.HandleMessages(); Players.ForEach(p => { p.Update(); }); Projectiles.ForEach(p => { p.Update(); }); GameObjects.ForEach(p => { p.Update(); }); BackgroundGameObjects.ForEach(p => { p.Update(); }); CheckProjectileCollisions(); ApplyShake(); if (MainGame.rand.Next(4) == 0) for (int i = 0; i < 5; i++) { GameObjects.Add(new TrainDust(new Vector2f(60 + (i * 440) + MainGame.rand.Next(70), 215), (float)MainGame.rand.NextDouble() * 90)); GameObjects.Add(new TrainDust(new Vector2f(304 + (i * 440) + MainGame.rand.Next(70), 215), (float)MainGame.rand.NextDouble() * 90)); } TrainDust td = new TrainDust(new Vector2f(2190 + MainGame.rand.Next(10), 75), (float)MainGame.rand.NextDouble() * 90, 2); GameObjects.Add(td); GameObjects.Add(new TrainDust(new Vector2f(1978 + MainGame.rand.Next(10), 75), (float)MainGame.rand.NextDouble() * 90, 1)); if (Input.isKeyTap(Keyboard.Key.LShift) && !player.Alive) { if (player.respawnTimer <= 0) { //Players.Remove(player); //player = new ClientPlayer(this); //Players.Add(player); player.deathTimer = 0; player.respawnTimer = player.respawnLength * 60; player.Pos = new Vector2f(42 + MainGame.rand.Next(1000), 142); player.Health = 100; player.Alive = true; } //player.Pos = new Vector2f(MainGame.rand.Next(42,1800), 142); //Mailman.SendRespawn(player.UID); } if (Input.isKeyDown(Keyboard.Key.P)) Console.WriteLine(player.Pos); if (Input.isKeyDown(Keyboard.Key.R)) { MainGame.Camera.Center += new Vector2f(MainGame.rand.Next(-4, 5) * shakeFactor / 5, MainGame.rand.Next(-4, 5) * shakeFactor / 5); } trainSound.Update(); Gui.Update(); }
public void handleControls() { try { if (!Gui.emoteMenuOpen) { if (Input.isKeyTap(Keyboard.Key.Num1)) { weapon = weapons[0]; MainGame.dm.Mailman.sendWeaponSwitch(0); } if (Input.isKeyTap(Keyboard.Key.Num2)) { if (weapons[1] != null) { weapon = weapons[1]; MainGame.dm.Mailman.sendWeaponSwitch(1); } } if (Input.isKeyTap(Keyboard.Key.Num3)) { if (weapons[2] != null) { weapon = weapons[2]; MainGame.dm.Mailman.sendWeaponSwitch(2); } } if (Input.isKeyTap(Keyboard.Key.Num4)) { if (weapons[3] != null) { weapon = weapons[3]; MainGame.dm.Mailman.sendWeaponSwitch(3); } } } } catch (Exception) { } ItemTimer--; if (Input.isKeyTap(Keyboard.Key.E)) { if (OnGround && ItemTimer <= 0) { ItemTimer = (40 * 60); switch (ItemType) { case 1: MainGame.dm.Mailman.SendLandMineCreate(MainGame.rand.Next(100000), this.Pos, this.UID); break; case 2: MainGame.dm.Mailman.SendGeneratorCreate(1, this.Pos); break; case 3: MainGame.dm.Mailman.SendGeneratorCreate(2, this.Pos); break; } } } if (Mouse.IsButtonPressed(Mouse.Button.Right)) { CrosshairCameraRatio = 1f; dm.PlayerAimSphereRadius = 175f; } else { CrosshairCameraRatio = .5f; dm.PlayerAimSphereRadius = 100f; } //Right click zooming? Kinda cool maybe I dunno AimAngle = Helper.angleBetween(MainGame.worldMousePos, Core); if (Input.isKeyTap(Keyboard.Key.R)) { weapon.Reload(); } if (!weapon.AutomaticFire) { if (Input.isMouseButtonTap(Mouse.Button.Left)) { weapon.Fire(); } } if (weapon.AutomaticFire) { if (Mouse.IsButtonPressed(Mouse.Button.Left)) { weapon.Fire(); } } if (Input.isKeyTap(Keyboard.Key.W) || Input.isKeyTap(Keyboard.Key.Space)) { if (OnGround || (JumpsLeft > 0)) // && Velocity.Y > 0)) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("jump.wav"), 1, .3f, 25)); TrainDust td = new TrainDust(this.Pos, 0, 1f); td.Alpha = 1; dm.GameObjects.Add(td); JumpsLeft--; Vector2f nextVec = new Vector2f(0, -10f); this.Velocity = nextVec; } } if (Input.isKeyDown(Keyboard.Key.A)) { this.Velocity.X -= Speed; } SoftDrop = Input.isKeyDown(Keyboard.Key.S); bool downKey = Input.isKeyTap(Keyboard.Key.S); if (downKey) { Velocity.Y = 10; } if (Input.isKeyDown(Keyboard.Key.D)) { this.Velocity.X += Speed; } Facing = 1; if (MainGame.worldMousePos.X < MainGame.dm.player.Pos.X) { Facing = -1; } if (Input.isKeyDown(Keyboard.Key.Q) && dm.devMode) { DropMoney(MainGame.rand.Next(8, 16)); } if (Input.isKeyTap(Keyboard.Key.R) && dm.devMode) { dm.GameObjects.Add(new TreasureBox(this.Pos)); } }