jasonrobot / gamedev

Join me on my journey of learning to make video games!
GNU General Public License v2.0
0 stars 0 forks source link

Refactor Part 2: Re-refactor #12

Closed jasonrobot closed 8 years ago

jasonrobot commented 8 years ago

There are some issues with how Objects and Controllers are being thrown around here. Its just sloppy and needs to be cleaned up before moving on to physics and stuff.

Problem: Some entities in game are raw Objects. Others are wrapped in controllers. The controllers share common code, which is a bad coding practice.

Solution: Move common Controller code into another table that can be used as the __index (or is it just the metatable?) for all Controller tables. Make a shim for static Objects that wraps them up nicely and gives everything a common..uhh... syntax?

jasonrobot commented 8 years ago

Looks like I finally understand metatables, because I was able to easily move all common Controller code to another table.

jasonrobot commented 8 years ago

also the shim was way easy