public PainterGameWorld() { //create objects backround = new SpriteGameObject("spr_background"); cannonBarrel = new RotatableSpriteObject("spr_cannon_barrel"); cannonBarrel.Position = new Vector2(74, 404); cannonBarrel.Origin = new Vector2(34, 34); scoreBoard = new SpriteGameObject("spr_scorebar"); livesSprites = new GameObjectList(); livesSprites.Position = new Vector2(0, 16); ball = new Ball(); cannonColor = new ThreeColorGameObject("spr_cannon_red", "spr_cannon_green", "spr_cannon_blue"); cannonColor.Position = new Vector2(58, 388); //start waarde geven om error te voorkomen. cannonColor.Color = Color.Blue; can1 = new PaintCan(450f, Color.Red); can2 = new PaintCan(575f, Color.Green); can3 = new PaintCan(700f, Color.Blue); scoreText = new TextGameObject("GameFont"); scoreText.Position = new Vector2(8, 8); //add objects this.Add(backround); this.Add(cannonBarrel); this.Add(cannonColor); this.Add(can1); this.Add(can2); this.Add(can3); this.Add(scoreBoard); this.Add(scoreText); this.Add(ball); //give values this.score = 0; scoreText.Text = "Score: " + "0"; this.lives = 5; this.maxLives = lives; for (int lifeNr = 0; lifeNr < maxLives; lifeNr++) { SpriteGameObject life = new SpriteGameObject("spr_lives", 0, lifeNr.ToString()); life.Position = new Vector2(lifeNr * life.BoundingBox.Width, 30); livesSprites.Add(life); } this.Add(livesSprites); }
public GameWorld() { background = new SpriteGameObject("spr_background"); cannonBarrel = new RotatableSpriteGameObject("spr_cannon_barrel"); cannonBarrel.Position = new Vector2(74, 404); cannonBarrel.Origin = new Vector2(34, 34); cannonColor = new ThreeColorGameObject("spr_cannon_red", "spr_cannon_green", "spr_cannon_blue"); cannonColor.Position = new Vector2(58, 388); paintCan1 = new PaintCan(450, Color.Red); paintCan2 = new PaintCan(575, Color.Green); paintCan3 = new PaintCan(700, Color.Blue); scorebar = new SpriteGameObject("spr_scorebar"); ball = new Ball(); scoreText = new TextGameObject("GameFont"); livesObjectList = new GameObjectList(); for (int i = 0; i < maxLives; i++) { newLive = new SpriteGameObject("spr_lives", 0, i.ToString()); newLive.Position = new Vector2(i * newLive.BoundingBox.Width, 50); livesObjectList.Add(newLive); } this.Add(background); this.Add(cannonBarrel); this.Add(cannonColor); this.Add(paintCan1); this.Add(paintCan2); this.Add(paintCan3); this.Add(ball); this.Add(scorebar); this.Score = 0; this.lives = maxLives; this.Add(livesObjectList); this.Add(scoreText); }
public PainterGameWorld() { cannonBarrel = new RotatableSpriteGameObject("spr_cannon_barrel"); cannonBarrel.Position = new Vector2(74, 404); cannonBarrel.Origin = new Vector2(34, 34); cannonColor = new ThreeColorGameObject("spr_cannon_red", "spr_cannon_green", "spr_cannon_blue"); cannonColor.Position = new Vector2(58, 388); can1 = new PaintCan(Color.Red, 450f); can2 = new PaintCan(Color.Green, 575f); can3 = new PaintCan(Color.Blue, 700f); ball = new Ball(); scoreText = new TextGameObject("GameFont"); scoreText.Text = "Score: 0"; scoreText.Position = new Vector2(24, 6); SpriteGameObject scoreBar = new SpriteGameObject("spr_scorebar"); livesSprites = new GameObjectList(); for (int lifeNr = 0; lifeNr < maxLives; lifeNr++) { SpriteGameObject life = new SpriteGameObject("spr_lives", 0, lifeNr.ToString()); life.Position = new Vector2(lifeNr * life.BoundingBox.Width, 30); livesSprites.Add(life); } this.score = 0; this.lives = maxLives; this.Add(new SpriteGameObject("spr_background")); this.Add(cannonBarrel); this.Add(cannonColor); this.Add(can1); this.Add(can2); this.Add(can3); this.Add(ball); this.Add(scoreBar); this.Add(scoreText); this.Add(livesSprites); }
public PainterGameWorld() { background = new SpriteGameObject("spr_background"); scoreBar = new SpriteGameObject("spr_scorebar"); // sgo = new SpriteGameObject("spr_lives"); cannonBarrel = new RotatableSpriteGameObject("spr_cannon_barrel"); cannonBarrel.Position = new Vector2(74, 404); cannonBarrel.Origin = new Vector2(34, 34); cannonColor = new ThreeColorGameObject("spr_cannon_red", "spr_cannon_green", "spr_cannon_blue"); cannonColor.Position = new Vector2(52, 398); ball = new Ball(); can1 = new PaintCan(450f, Color.Red); can2 = new PaintCan(575f, Color.Green); can3 = new PaintCan(700f, Color.Blue); scoreText = new TextGameObject("GameFont"); scoreText.Position = new Vector2(8, 8); livesSprites = new GameObjectList(); livesSprites.Position = new Vector2(0, 16); this.Add(background); this.Add(cannonBarrel); this.Add(cannonColor); this.Add(can1); this.Add(can2); this.Add(can3); this.Add(ball); this.Score = 0; this.lives = 5; this.Add(scoreBar); // this.Add(sgo); this.maxLives = lives; this.Add(scoreText); this.Add(livesSprites); cannonColor.Color = Color.Blue; for (int lifeNr = 0; lifeNr < maxLives; lifeNr++) { SpriteGameObject life = new SpriteGameObject("spr_lives", 0, lifeNr.ToString()); life.Position = new Vector2(lifeNr * life.BoundingBox.Width, 30); livesSprites.Add(life); } }