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); }
// Add sprites to the sprite list for drawing public void set(Sprite spr) { sprites.Add(spr); }
// Add Sprites to the game public void AddSprite(Sprite s) { render.set(s); }
// 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; } }