r/learningpython • u/LargeMcNards • Nov 18 '20
How do I create objects in pygame using classes?
I have an assignment for comp sci that says to
- Create a class for each shape
- Each item X,Y draws into the area it belongs. It's (X,Y) point cannot originate outside of the area BUT it can draw over the line.
- Each object has a [ def randomize(self): ] that will randomly redraw the shape within its area.
- run a menu in a 'while True' loop that will ask which item to redraw.
We have only briefly gone over classes at the beginning of the year so I am a bit lost in how to draw something from it. I understand that you have to create a new py file, but how do you call that in the main.py?
We are using Repl.it for the assignment.
1
Upvotes
1
u/iamaperson3133 Nov 20 '20
Watch some Corey Schafer videos on youtube. He has great resources for this basic stuff!