pythonarcade / arcade

Easy to use Python library for creating 2D arcade games.

Home Page:http://arcade.academy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples: Revamp the setup() methods

einarf opened this issue · comments

We should really declare all variables with types in __init__ while setup() should attempt to reuse these types as much as possible. This mans type hinting and code completion will work across a wide variety of editors. We also teach the users to do a proper "reset".

In addition we should probably write a doctring for the setup() method explaining its purpose also stressing that it's not a part of arcade (window / view), but something optional we do do support resetting the game / view.

Possibly renaming setup() to reset() would make more sense.

Should reset() be something we guarantee is on a View? Then you could in theory make a self-reloading View by saying that on_show_view() calls reset() and be safe in the knowledge that that method exists.

Should reset() be something we guarantee is on a View? Then you could in theory make a self-reloading View by saying that on_show_view() calls reset() and be safe in the knowledge that that method exists.

Likely it's better to keep that user defined. It might just turn into another magic thing you need to know about. This is high level management of content and it's hard to predict what users want. What I know for sure is that resetting a view is not always what you want.

Some examples have been fixed already but this requires community effort.