protected override void PlayAttackAnimation() { float x = this.PositionWorldspace.X - this.attackTarget.PositionWorldspace.X; float y = this.PositionWorldspace.Y - this.attackTarget.PositionWorldspace.Y; attackDrawNode = new CCDrawNode(); attackDrawNode.DrawLine(CCPoint.Zero, new CCPoint(x * -1, y * -1), CCColor4B.Red, CCLineCap.Butt); this.AddChild(attackDrawNode); attackDrawNode.RunActions(new CCFadeOut(0.5f), new CCRemoveSelf(true)); }
void Fire() { var shot = new CCDrawNode(); shot.DrawCircle(new CCPoint(0, 0), SHOT_RADIUS, CCColor4B.Red); shots.AddChild(shot); shot.Position = new CCPoint(ship.Position.X + 60.0f, ship.Position.Y - 2.5f); var moveShot = new CCMoveTo(1.0f, new CCPoint(VisibleBoundsWorldspace.MaxX, shot.Position.Y)); shot.RunActions(moveShot, removeNodeAction); }
void AddEnemy() { var enemy = new CCDrawNode(); enemy.DrawCircle(new CCPoint(0, 0), ENEMY_RADIUS, CCColor4B.Blue); enemy.Position = GetRandomPointY(ENEMY_RADIUS); enemies.AddChild(enemy); var moveEnemy = new CCMoveTo(3.0f, new CCPoint(0, enemy.Position.Y)); enemy.RunActions(moveEnemy, removeNodeAction); }