public void Update(MapEngine map, float deltaTime) { // save old position var oldPos = (Pos / new VectorF(map.TileWidth, map.TileHeight)).ToVector(); // running if (_inputManager.IsPressedInput((int)Input.FaceButtonLeft)) { speedX = speedY = 300; } else { speedX = speedY = 150; } // animate if (_inputManager.IsPressedKey((int)Keys.Up) || _inputManager.IsPressedKey((int)Keys.Down) || _inputManager.IsPressedKey((int)Keys.Left) || _inputManager.IsPressedKey((int)Keys.Right)) { animation.Step(); IsMoving = true; step += deltaTime; if (_inputManager.IsPressedInput((int)Input.FaceButtonLeft)) { step += deltaTime; } } else { animation.frame = 1; IsMoving = false; } // move player if (_inputManager.IsPressedKey((int)Keys.Up)) { MoveUp(map, deltaTime); } if (_inputManager.IsPressedKey((int)Keys.Down)) { MoveDown(map, deltaTime); } if (_inputManager.IsPressedKey((int)Keys.Left)) { MoveLeft(map, deltaTime); } if (_inputManager.IsPressedKey((int)Keys.Right)) { MoveRight(map, deltaTime); } if (_inputManager.AnyPressedKey((int)Keys.Up, (int)Keys.Down, (int)Keys.Left, (int)Keys.Right)) { map.UpdateCamera(Pos.ToVector()); } // check walkon event var newPos = (Pos / new VectorF(map.TileWidth, map.TileHeight)).ToVector(); if (newPos != oldPos) { WalkOnTile(new MoveEventArgs(oldPos, newPos)); } // action button pressed if (_inputManager.IsPressedInput((int)Input.FaceButtonDown)) { Action(); } }