Exemple #1
0
 private void checkCanCollision(PaintCan can)
 {
     if (this.ball.CollidesWith(can) && ball.Shooting)
     {
         can.Color = this.ball.Color;
         this.ball.Reset();
     }
 }
Exemple #2
0
 public GameWorld(ContentManager content)
 {
     background = content.Load <Texture2D>("spr_background");
     cannon     = new Cannon(content);
     ball       = new Ball(content);
     can1       = new PaintCan(content, 450.0f, Color.Red);
     can2       = new PaintCan(content, 575.0f, Color.Green);
     can3       = new PaintCan(content, 700.0f, Color.Blue);
 }
Exemple #3
0
        public PainterGameWorld()
        {
            scoreObj          = new TextGameObject("GameFont");
            scoreObj.Text     = "";
            scoreObj.Position = new Vector2(24, 6);
            SpriteGameObject scoreBar = new SpriteGameObject("spr_scorebar");

            livesObj = new GameObjectList();
            cannon   = new Cannon();

            can1 = new PaintCan(Color.Red, 450f);
            can2 = new PaintCan(Color.Green, 575f);
            can3 = new PaintCan(Color.Blue, 700f);

            ball = new Ball();

            for (int i = 0; i < Painter.maxLives; i++)
            {
                SpriteGameObject life = new SpriteGameObject("spr_lives", 0, i.ToString());
                life.Position = new Vector2(i * life.BoundingBox.Width, 30);
                livesObj.Add(life);
            }

            this.Score = 0;
            this.Lives = Painter.maxLives;

            this.Add(new SpriteGameObject("spr_background"));
            this.Add(scoreBar);
            this.Add(ball);
            this.Add(can1);
            this.Add(can2);
            this.Add(can3);
            this.Add(cannon.Cannon_barrel);
            this.Add(cannon.CannonColor);
            this.Add(scoreObj);
            this.Add(livesObj);
        }