Exemple #1
0
 public bool ButtonClick(Cans c)
 {
     if (this.pos.X >= c.position.X && // To the right of the left side
         this.pos.X <= c.position.X + 22 && //To the left of the right side
         this.pos.Y >= c.position.Y && //Below the top side
         this.pos.Y <= c.position.Y + 39) //Above the bottom side
     {
         return(true);                    //We are; return true.
     }
     else
     {
         return(false); //We're not; return false.
     }
 }
Exemple #2
0
        public void LoadContent(ContentManager content, SpriteBatch spriteBatch)
        {
            Content          = content;
            this.spriteBatch = spriteBatch;
            can_tex          = Content.Load <Texture2D>("trashs\\Can");
            red_trash        = content.Load <Texture2D>("trashs\\GameRecycleRed");
            add_score        = content.Load <Texture2D>("trashs\\plus10");
            minus_score      = content.Load <Texture2D>("trashs\\minus5");

            for (int i = 0; i < no_of_cans; i++)
            {
                can_x = can_rand.Next(50, 650) + can_rand.Next(40);
                can_y = can_rand.Next(150, 450) + can_rand.Next(60);

                can[i] = new Cans(new Vector2(can_x, can_y), can_tex);
                can_list.Add(can[i]);
            }


            mPreviousMouseState = Mouse.GetState();
        }