public Player(PlayerIndex playerIndex, Team team, Vector2 submatrix,
CourtPosition position)
: base()
{
this.playerIndex = playerIndex;
this.team = team;
spriteSubmatrix = submatrix;
heading = Heading.Forward;
courtPosition = position;
switch (position) {
case CourtPosition.TopLeft:
x = 15;
y = 65;
break;
case CourtPosition.TopRight:
x = 414;
y = 65;
break;
case CourtPosition.BottomLeft:
x = 15;
y = 180;
break;
case CourtPosition.BottomRight:
x = 414;
y = 180;
break;
}
maxSpeed = MAX_RUN_SPEED;
drag = new Vector2(CONTROL_DRAG,CONTROL_DRAG);
loadGraphic("player", 34, 34);
characterOffset.X = submatrix.X * atlas.Width / 2;
characterOffset.Y = submatrix.Y * atlas.Height / 2;
sheetOffset.X = characterOffset.X;
playerGlow = new PlayerGlow(this);
G.state.add(playerGlow);
addAnimation("idle", new List<int> { 0, 1, 2, 3 }, 10, true);
addAnimation("runForward", new List<int> { 12, 13, 14, 15 }, 15, true);
addAnimation("runBackward", new List<int> { 16, 17, 18, 19 }, 15, true);
addAnimation("runUpForward", new List<int> { 4, 5, 6, 7 }, 15, true);
addAnimation("runDownForward", new List<int> { 8, 9, 10, 11 }, 15, true);
addAnimation("runUpBackward", new List<int> { 8, 11, 10, 9 }, 15, true);
addAnimation("runDownBackward", new List<int> { 6, 5, 4, 7 }, 15, true);
addAnimation("throw", new List<int> { 0, 1, 2, 3 }, 10, false);
addAnimation("throwReturn", new List<int> { 4, 4 }, 20, false);
addAnimationCallback("throw", onThrowCallback);
addOnCompleteCallback("throw", onThrowCompleteCallback);
addOnCompleteCallback("throwReturn", onThrowReturnCompleteCallback);
addAnimation("hurt", new List<int> { 5 });
addAnimation("hurtFall", new List<int> { 6, 7 }, 10, false);
addAnimation("hurtRecover", new List<int> { 8, 8 }, 20, false);
addOnCompleteCallback("hurtRecover", onHurtRecoverCompleteCallback);
addAnimationCallback("hurtFall", onHurtFallCallback);
addAnimation("parry", new List<int> { 10, 9, 9, 10 }, 40, false);
addAnimation("parryReturn", new List<int> { 10, 10 }, 20, false);
addOnCompleteCallback("parryReturn", onParryReturn);
throwOffsets[(int)Heading.Up] = new Vector2[3] {
new Vector2(0, 0),
new Vector2(0, 0),
new Vector2(0, 0)
};
throwOffsets[(int)Heading.UpMid] = new Vector2[3] {
new Vector2(0, 0),
new Vector2(0, 0),
new Vector2(0, 0)
};
throwOffsets[(int)Heading.Forward] = new Vector2[3] {
new Vector2(1, 0),
new Vector2(3, 0),
new Vector2(1, 0)
};
throwOffsets[(int)Heading.DownMid] = new Vector2[3] {
new Vector2(0, 0),
new Vector2(0, 0),
new Vector2(0, 0)
};
throwOffsets[(int)Heading.Down] = new Vector2[3] {
new Vector2(0, 0),
new Vector2(0, 0),
new Vector2(0, 0)
};
//We can change this to use Heading later if needed
fallOffsets = new Vector2[2] {
new Vector2(-4, 0),
new Vector2(-11, 0)
};
//No actual hit yet, this should substitute for now
addAnimation("hit", new List<int> { 12, 13, 14, 15 }, 60, true);
height = 22;
offset.Y = -5;
width = 18;
offset.X = -9;
shadow = new PlayerShadow(this);
G.state.add(shadow);
retical = new Retical(playerIndex, team);
retical.visible = false;
G.state.add(retical);
blood = new BloodSpatter(this);
G.state.add(blood);
play("idle");
}