// shut public override void Shoot(GameScreen screen, Vector2 direction) { if (GameInput.InputPressed(GameInput.ShootInput)) { Vector2 speed = new Vector2(Math.Sign(direction.X), Math.Sign(direction.Y)) * MyMaths.Normalize(direction.X, direction.Y) * direction * 6; Vector2 bulletPos = screen.Player.Position; screen.GameObjects.Add(new PlayerLaser(screen, speed, bulletPos)); } }
// shut public override void Shoot(GameScreen screen, Vector2 direction) { if (GameInput.InputPressed(GameInput.ShootInput)) { BasicPlayerBullet bullet = new BasicPlayerBullet(screen, new Vector2(Math.Sign(direction.X), Math.Sign(direction.Y)) * MyMaths.Normalize(direction.X, direction.Y) * direction * 6); bullet.Position = screen.Player.Position; screen.GameObjects.Add(bullet); screen.ScreenEffects.Add(new CameraShakeEffect(screen, 2, 4)); } }
// Update player public override void Update(GameTime gameTime) { // Do start update things StartUpdate(); // Normalized vector if (GameInput.ControllerMode) { //norm = MyMaths.Normalize(GameControlls.LeftStickX, GameControlls.LeftStickY); norm.X = GameInput.LeftStickX; norm.Y = GameInput.LeftStickY; if (Math.Abs(norm.X) > 0.70f || Math.Abs(norm.Y) > 0.70f) { norm = MyMaths.Normalize(GameInput.LeftStickX, GameInput.LeftStickY); } } else { norm = MyMaths.Normalize((GameInput.RightCD ? 1 : 0) - (GameInput.LeftCD ? 1 : 0), (GameInput.DownCD ? 1 : 0) - (GameInput.UpCD ? 1 : 0)); } // Do movement if no cutscene if (!GahameController.CutScene) { // Horizontal speed if (GameInput.RightCD || GameInput.LeftCD) { // le nice walk horizontal thing WalkHorizontal(maxSpeed * norm.X); } // Vertical speed if (GameInput.UpCD || GameInput.DownCD) { // le nice walk horizontal thing WalkVertical(maxSpeed * norm.Y); } } // Activate Object if (GameInput.ActivateCD) { // Insane if (hitBox.InstancePlace <ActivatableObject>(Position + direction) is ActivatableObject o) { o.Activate(); } else { Dialogue d = hitBox.DialogueMeeting(Position + direction); if (d != null) { d.StartDialogue(); } } screen.ScreenEffects.Add(new CameraShakeEffect(screen, 4, 20)); } // Update component last base.Update(gameTime); }