public void rotateObject(AnimatedGameObject gameObject) { if (KEYBOARD.KeyDown(rotateAntiClockwise)) { gameObject.rotation -= rotationSpeed; } if (KEYBOARD.KeyDown(rotateClockwise)) { gameObject.rotation += rotationSpeed; } }
public void customUser() { if (MOUSE.RightClicked) { explosions.Add(new Explosion(camera.mouseWC, 10, fireballs)); } if (KEYBOARD.KeyDown(Keys.I)) { DestructableTerrain d = new DestructableTerrain(camera.mouseWC, Graphics.CreateTexture2D(50, 50, Color.Black, Color.Black)); environment.Add(d); environment.partitionObject(d); } }
protected override void Update(GameTime gameTime) { base.Update(gameTime); MOUSE.Update(); KEYBOARD.Update(); _frame++; if (KEYBOARD.KeyDown(ExitKey)) { ExitGame(); } elapsedTime += gameTime.ElapsedGameTime; if (elapsedTime > TimeSpan.FromSeconds(1)) { elapsedTime -= TimeSpan.FromSeconds(1); frameRate = frameCounter; frameCounter = 0; } }
public void controlCharacter(Engine.Character.GenericCharacter character) { if (KEYBOARD.KeyDown(forwardKey)) { character.moveForward(); } if (KEYBOARD.KeyDown(backwardKey)) { character.moveBackward(); } if (KEYBOARD.KeyDown(leftKey)) { character.moveLeft(); } if (KEYBOARD.KeyDown(rightKey)) { character.moveRight(); } }
public void controlObject(AnimatedGameObject gameObject) { if (KEYBOARD.KeyDown(forwardKey)) { gameObject._position = Trig.MoveToCurrentDirection(gameObject._position, gameObject.rotation, movementSpeed); } if (KEYBOARD.KeyDown(backwardKey)) { gameObject._position = Trig.MoveToCurrentDirection(gameObject._position, gameObject.rotation, -movementSpeed); } if (KEYBOARD.KeyDown(leftKey)) { gameObject._position = Trig.MoveToCurrentDirection(gameObject._position, gameObject.rotation - Trig.PI_Half, movementSpeed); } if (KEYBOARD.KeyDown(rightKey)) { gameObject._position = Trig.MoveToCurrentDirection(gameObject._position, gameObject.rotation + Trig.PI_Half, movementSpeed); } }