public void Bomb() { DInput.SendKey(0x4B, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x4D, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x2C, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); Thread.Sleep(20); DInput.SendKey(0x2D, DInput.KEYEVENTF_SCANCODE); Thread.Sleep(20); DInput.SendKey(0x2D, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); }
public void DoPlayerMovement(Vec2 force) { if (Math.Abs(force.X) > 3000 || Math.Abs(force.Y) > 3000) { Bomb(); } // Spam Z DInput.SendKey(0x2C, DInput.KEYEVENTF_SCANCODE); // Ensure the force is large enough to worry about if (Math.Abs(force.X) > 0.05) { if (force.X < 0) { DInput.SendKey(0x4B, DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x4D, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); } else { DInput.SendKey(0x4D, DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x4B, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); } } else { DInput.SendKey(0x4D, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x4B, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); } if (Math.Abs(force.Y) > 0.05) { if (force.Y < 0) { DInput.SendKey(0x48, DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x50, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); } else { DInput.SendKey(0x50, DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x48, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); } } else { DInput.SendKey(0x50, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); DInput.SendKey(0x48, DInput.KEYEVENTF_KEYUP | DInput.KEYEVENTF_SCANCODE); } }