Check the official documents as follows: Surface objects are objects that represent a rectangular 2D image. The Sprite class is intended to be used as a base class for the different types of objects in the game.
They all have image and rect attributes.The difference is that sprites can be grouped?
They all have image and rect attributes [...]
No this is wrong. A pygame.Surface has not rect attribute. pygame.Surface.get_rect.get_rect() returns a rectangle with the size of the Surface object, that always starts at (0, 0) since a Surface object has no position. The rectangle returned is just a rectangle the size of the surface area starting at (0, 0).
In short words: A pygame.Surface has no location, it's just a bitmap. A pygame.sprite.Sprite is a object that consists of a Surface object and pygame.Rect object. An instance of a Sprite describes the position of an image in the game window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With