public void Update(GameTime gameTime) { Animation.Update(gameTime); if (AnimState == AnimState.Walking) { Animation = AnimManager.Animations[1]; if (Direction == Direction.left) { Body.Position = new Vector2(Body.Position.X - 1, Body.Position.Y); } else if (Direction == Direction.right) { Body.Position = new Vector2(Body.Position.X + 1, Body.Position.Y); } } else if (AnimState == AnimState.Jumping) { var forces = new Vector2((int)Direction, -2); Body.ApplyLinearImpulse(forces); } else { Animation = AnimManager.Animations[0]; } if (Body.Position.X > 0 && Body.Position.Y > 0) { Current = new Point((int)Body.Position.X, (int)Body.Position.Y); if (Body.Position.Y > 696) { Body.Position = new Vector2(Start.X + 1, Start.Y); } } }
public virtual void Update(GameTime gameTime) { // targetPos = originalTargetPos; proximityIndicator = spriteGameSize; // Console.Out.WriteLine(shapeHitBox[1] + " & " + originalShapeHitBox[1]); /* * This handles movement * * * * */ bRender = SceneUtility.isWithinMap(position); /* * if (position.X > SceneUtility.currentMapSize.X + shapeTextureBounds.Width * scale) * { * bRender = false; * * } * else if (position.Y > SceneUtility.currentMapSize.Y + shapeTextureBounds.Height * scale) * { * bRender = false; * } * else if (position.X < 0 - shapeTextureBounds.Height * scale-100) * { * bRender = false; * } * else if (position.Y < 0 - shapeTextureBounds.Height * scale-100) * { * bRender = false; * }*/ /* * Do other stuff below * * * */ if (bHasAnimations && bPlayAnimation) { shapeAnimation.Update(gameTime); shapeAnimation.currentAnimation = animationIndex; } if (bHasDynamicHitbox && bHasAnimations && !prevFrameBounds.Equals(shapeAnimation.currentFrameBounds)) { // GenerateDynamicHitBoxes(shapeAnimation.currentFrameBounds); } if (bHasDynamicHitbox && bHasAnimations) { // prevFrameBounds = shapeAnimation.currentFrameBounds; } // originalPosition = position / 1; }