Closed yonghuming closed 3 years ago
could i make a pr? and will this be merged?
You can do this
add setup()
at the top of your code
and def setup():
- your function that is setup code.
Now when you start your program, the setup()
function is the first thing to be done
Yeah, I'm not sure either of these are a good candidate to be in Pygame Zero itself.
The whole module is run at start time, so as @fillwithjoy1 says, you can just call your setup()
function at the bottom of the module.
The draw method shortcuts seem like too much pollution of the namespace. In particular something like rect() shouldn't be in builtins because Rect() is in the builtins and does something completely different.
i add
get_setup_func
toPGZeroGame
class, if setup exist in main.py, call it once inmainloop
method.and mainloop:
also i create a procesing.py file
and import in builtins.py
so can draw shapes with shorter function
rect
instead ofscreen.draw.rect
method, and all parameter are samei want to do some work making pgzero like p5py or processing.py, or processing or p5.js , it's more friendly to newbee who have little programming expriences.