/* * Initialise the ball(s) * */ public void Initialise() { ResetColour(); ball = new MovingBall(core, colour); Console.WriteLine("new ball"); ball.Initialise(new Vector2(50f, 50f), StartPosition(), game); }
/* * Update the ball, and generate new ones if necessary * */ public void Update(GameTime gameTime) { if (ball.IsLive()) { ball.Move(); } else { ball = ballGenerator.Remove(); ball.Position = StartPosition(); //LoadGraphicsContent(); } }
public void UpdateLoose() { for (int i = 0; i < ballsSize; i++) { balls[i].CheckSupports(); } bool redo = false; for (int i = 0; i < ballsSize; i++) { if (!balls[i].IsAgainstCore() && balls[i].Unsupported() && !balls[i].IsDead()) { redo = true; MovingBall m = new MovingBall(this, balls[i].colour); m.Initialise(balls[i].Size, balls[i].Position, this.game); m.LoadGraphicsContent(balls[i].spriteBatch, balls[i].colourTexture); balls[i].Destroy(); balls.Remove(balls[i]); ballsSize--; looseBalls.Add(m); looseBallsSize++; } } if (redo == true) { UpdateLoose(); } }
public void Initialise() { ball = new MovingBall(core,Image.value.green); ball.Initialise(new Vector2(50f, 50f), new Vector2(0f, 0f)); }