|
@ -4,7 +4,7 @@ using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
|
|
|
namespace SemiColinGames { |
|
|
namespace SemiColinGames { |
|
|
class Player { |
|
|
|
|
|
|
|
|
public class Player { |
|
|
private enum Pose { Walking, Standing, Crouching, Stretching, SwordSwing, Jumping }; |
|
|
private enum Pose { Walking, Standing, Crouching, Stretching, SwordSwing, Jumping }; |
|
|
|
|
|
|
|
|
private const int moveSpeed = 180; |
|
|
private const int moveSpeed = 180; |
|
@ -48,7 +48,7 @@ namespace SemiColinGames { |
|
|
|
|
|
|
|
|
public Point Position { get { return position; } } |
|
|
public Point Position { get { return position; } } |
|
|
|
|
|
|
|
|
public void Update(float modelTime, AABB[] collisionTargets, History<Input> input) { |
|
|
|
|
|
|
|
|
public void Update(float modelTime, World world, History<Input> input) { |
|
|
AABB BoxOffset(Point position, int yOffset) { |
|
|
AABB BoxOffset(Point position, int yOffset) { |
|
|
return new AABB(new Vector2(position.X, position.Y + yOffset), halfSize); |
|
|
return new AABB(new Vector2(position.X, position.Y + yOffset), halfSize); |
|
|
} |
|
|
} |
|
@ -72,7 +72,7 @@ namespace SemiColinGames { |
|
|
AABB largeBox = new AABB( |
|
|
AABB largeBox = new AABB( |
|
|
new Vector2(position.X + movement.X / 2, position.Y + movement.Y / 2), |
|
|
new Vector2(position.X + movement.X / 2, position.Y + movement.Y / 2), |
|
|
new Vector2(halfSize.X + Math.Abs(movement.X) + 1, halfSize.Y + Math.Abs(movement.Y) + 1)); |
|
|
new Vector2(halfSize.X + Math.Abs(movement.X) + 1, halfSize.Y + Math.Abs(movement.Y) + 1)); |
|
|
foreach (var box in collisionTargets) { |
|
|
|
|
|
|
|
|
foreach (var box in world.CollisionTargets) { |
|
|
if (box.Intersect(largeBox) != null) { |
|
|
if (box.Intersect(largeBox) != null) { |
|
|
// Debug.AddRect(box, Color.Green);
|
|
|
// Debug.AddRect(box, Color.Green);
|
|
|
candidates.Add(box); |
|
|
candidates.Add(box); |
|
|