Esempio n. 1
0
        public static List<Sprite> sprites = new List<Sprite>(); // List of sprites

        #endregion Fields

        #region Methods

        // Call this method to initalise all sprites in the game
        public static void AddSprite(Sprite s)
        {
            sprites.Add(s);
        }
Esempio n. 2
0
 // Add sprites to the sprite list for drawing
 public void set(Sprite spr)
 {
     sprites.Add(spr);
 }
Esempio n. 3
0
 // Add Sprites to the game
 public void AddSprite(Sprite s)
 {
     render.set(s);
 }
Esempio n. 4
0
 // Boolean to see if sprite is colliding with other sprite
 public bool IsColliding(Sprite spr)
 {
     if(position.x > spr.position.x && position.x < (spr.position.x + spr.size.x))
     {
         if(position.y > spr.position.y && position.y < (spr.position.y + spr.size.y))
         {
             return true;
         }
         else if((position.y + size.y) > spr.position.y && (position.y + size.y) < (spr.position.y + spr.size.y))
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else if ((position.x + size.x) > spr.position.x && (position.x + size.x) < (spr.position.x + spr.size.x))
     {
         if (position.y > spr.position.y && position.y < (spr.position.y + spr.size.y))
         {
             return true;
         }
         else if ((position.y + size.y) > spr.position.y && (position.y + size.y) < (spr.position.y + spr.size.y))
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         return false;
     }
 }