protected override void Initialize() { // TODO: Add your initialization logic here // Objects hero = new Hero(); blocks = new List <IMapObject>(); blocks.Add(new Block(new Vector2(300, 280))); blocks.Add(new Block(new Vector2(400, 280))); blocks.Add(new Block(new Vector2(500, 280))); blocks.Add(new Block(new Vector2(500, 220))); // Collision colliders = new List <BoxCollider>(); foreach (IMapObject block in blocks) { colliders.Add(block.Collider); } collisionManager = new CollisionManager(colliders, hero); base.Initialize(); }
public void Update(GameTime gameTime) { // Read input MoveDirection = KeyboardReader.ReadInput(); // Jumping JumpCommand.CheckJumping(); JumpCommand.Execute(this); // Move character Direction = MoveCommand.Execute(this, MoveDirection); // Update collider Collider = CollisionManager.UpdateCollider(Position, Collider, Xoffset, Yoffset); // Choose animation according to direction AnimateCommand.Execute(this, MoveDirection); // Animate accordingly currentAnimation = Animator.Animate(AnimToPlay); Animator.Update(gameTime); }