public PlayerShadow(Player player, float X=0, float Y=0) : base(X,Y) { addAnimation("idle", new List<int> { 0 }, 10, true); addAnimation("runForward", new List<int> { 0 }, 15, true); addAnimation("runBackward", new List<int> { 0 }, 15, true); addAnimation("runUpForward", new List<int> { 1 }, 15, true); addAnimation("runDownForward", new List<int> { 2 }, 15, true); addAnimation("runUpBackward", new List<int> { 2 }, 15, true); addAnimation("runDownBackward", new List<int> { 1 }, 15, true); addAnimation("throw", new List<int> { 0 }, 10, false); addAnimation("throwReturn", new List<int> { 0 }, 20, false); addAnimation("parry", new List<int> { 0 }, 10, false); addAnimation("parryReturn", new List<int> { 0 }, 20, false); addAnimation("hurt", new List<int> { 0 }); addAnimation("hurtFall", new List<int> { 1, 2 }, 10, false); addAnimation("hurtRecover", new List<int> { 1, 1 }, 20, false); z = 0; this.player = player; loadGraphic("playerShadow", 34, 9); height = 21; offset.Y = 5; if(player.onRight) { sheetOffset.X = atlas.Width / 2; } }
public HealthBar(Player player, Sprite scoreBoard) : base() { this.player = player; this.scoreBoard = scoreBoard; switch(player.courtPosition) { case CourtPosition.TopLeft: x = ((PlayState.ARENA_WIDTH - HUD.SCOREBOARD_WIDTH) / 2) + BAR_OFFSET_X; y = -HUD.SCOREBOARD_HEIGHT - HUD.SCOREBOARD_OFFSET + BAR_OFFSET_TOP_Y; imageIndex = new Vector2(0, 0); break; case CourtPosition.TopRight: x = scoreBoard.x + scoreBoard.width - BAR_WIDTH - BAR_OFFSET_X; y = -HUD.SCOREBOARD_HEIGHT - HUD.SCOREBOARD_OFFSET + BAR_OFFSET_TOP_Y; imageIndex = new Vector2(1, 0); break; case CourtPosition.BottomLeft: x = ((PlayState.ARENA_WIDTH - HUD.SCOREBOARD_WIDTH) / 2) + BAR_OFFSET_X; y = -HUD.SCOREBOARD_HEIGHT - HUD.SCOREBOARD_OFFSET + BAR_OFFSET_BOTTOM_Y; imageIndex = new Vector2(0, 1); break; case CourtPosition.BottomRight: x = scoreBoard.x + scoreBoard.width - BAR_WIDTH - BAR_OFFSET_X; y = -HUD.SCOREBOARD_HEIGHT - HUD.SCOREBOARD_OFFSET + BAR_OFFSET_BOTTOM_Y; imageIndex = new Vector2(1, 1); break; } hurtHealth = new Sprite(x, y); hurtHealth.loadGraphic("healthBar", BAR_WIDTH, BAR_HEIGHT); hurtHealth.color = new Color(0xcb, 0x00, 0x07); healthBars.add(hurtHealth); realHealth = new Sprite(x, y); realHealth.loadGraphic("healthBar", BAR_WIDTH, BAR_HEIGHT); healthBars.add(realHealth); healHealth = new Sprite(x, y); healHealth.loadGraphic("healthBar", BAR_WIDTH, BAR_HEIGHT); healthBars.add(healHealth); add(healthBars); hurtHealth.sheetOffset = realHealth.sheetOffset = healHealth.sheetOffset = new Vector2(imageIndex.X * BAR_WIDTH, imageIndex.Y * BAR_HEIGHT); }
public PlayerGlow(Player player) : base(player.x, player.y) { this.player = player; blend = BlendState.Additive; loadGraphic("player", 34, 34); width = player.width; height = player.height; sheetOffset = player.sheetOffset; offset = player.offset; if(player.onRight) { sheetOffset.X = atlas.Width / 2; } alpha = 0; visible = false; }
public BloodSpatter(Player player, float X=0, float Y=0) : base(X,Y) { if(player.team == Team.Left) { sheetOffset.Y = 16; offset.X = 14; offset.Y = -4; } else { offset.X = -14; offset.Y = -2; } this.player = player; visible = false; loadGraphic("bloodSpray", 16, 16); addAnimation("spray", new List<int> { 0, 1, 2, 2, 3, 3, 4 }, 20); addOnCompleteCallback("spray", onSprayCompleteCallback); }
public void onCollide(Player player, bool playerWasDead=false) { if(dangerous && !playerWasDead && owner != null && player.team != owner.team) { bounceVelocity = -PLAYER_VERTICAL_BOUNCE; hitWall(false); } }