public override void Update(GameTime gameTime, GameEngine.TeeEngine engine) { if (CurrentDrawableState.Contains("Spin")) { } base.Update(gameTime, engine); }
public void Spin(GameTime gameTime) { if (CurrentDrawableState.Contains("Idle")) { // Reset the animations Drawables.ResetGroup("Body", gameTime); CurrentDrawableState = "Spin_" + Direction; } }
public override void Update(GameTime gameTime, TeeEngine engine) { KeyboardState keyboardState = Keyboard.GetState(); Vector2 movement = Vector2.Zero; float prevX = Pos.X; float prevY = Pos.Y; Tile prevTile = engine.Map.GetPxTopMostTile(Pos.X, Pos.Y); float moveSpeedModifier = prevTile.GetProperty <float>("MoveSpeed", 1.0f); // ATTACK KEY. if (keyboardState.IsKeyDown(Keys.A)) { bool reset = !CurrentDrawableState.StartsWith("Slash"); CurrentDrawableState = "Slash_" + Direction; if (reset) { Drawables.ResetState(CurrentDrawableState, gameTime); } } else { // MOVEMENT BASED KEYBOARD EVENTS. if (keyboardState.IsKeyDown(Keys.Up)) { CurrentDrawableState = "Walk_Up"; Direction = Direction.Up; movement.Y--; } if (keyboardState.IsKeyDown(Keys.Down)) { CurrentDrawableState = "Walk_Down"; Direction = Direction.Down; movement.Y++; } if (keyboardState.IsKeyDown(Keys.Left)) { CurrentDrawableState = "Walk_Left"; Direction = Direction.Left; movement.X--; } if (keyboardState.IsKeyDown(Keys.Right)) { CurrentDrawableState = "Walk_Right"; Direction = Direction.Right; movement.X++; } if (KeyboardExtensions.GetKeyDownState(keyboardState, Keys.T, this, true)) { if (IsEquiped(ItemRepository.GameItems["RobeShirt"])) { Equip(ItemRepository.GameItems["PlateChest"]); } else { Equip(ItemRepository.GameItems["RobeShirt"]); } } // Set animation to idle of no movements where made. if (movement.Length() == 0) { CurrentDrawableState = "Idle_" + Direction; } else { movement.Normalize(); Pos += movement * MOVEMENT_SPEED * moveSpeedModifier; } LightSource.Pos = this.Pos; } base.Update(gameTime, engine); }