Question: RectangleSprite Begin by creating a RectangleSprite class. Constructor This class must have a constructor which accepts four parameters: size, location , color , and win

RectangleSprite
Begin by creating a RectangleSprite class.
Constructor
This class must have a constructor which accepts four parameters: size,location,color, andwin (the window -- a Pygame display object). Inside the constructor, use these parameters to initialize rectangle at the given location (you may align the center of the rectangle with the given coordinates) and store it in the instance variable rect . Also create and set the color and win instance variables.
RectangleSprite.draw
This class also needs adraw method, which uses pygame.draw.rect to render the object. You will need to make use of the instance variablesself.rect, self.color, and self.win.
RectangleSprite.move

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!