arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Examples: Revamp the setup() methods

Open einarf opened this issue 1 year ago • 3 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.

einarf avatar Jun 22 '24 20:06 einarf

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.

DigiDuncan avatar Jun 22 '24 21:06 DigiDuncan

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.

einarf avatar Jun 23 '24 11:06 einarf

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

einarf avatar Jul 12 '24 17:07 einarf