tshirtman / ultimate-smash-friends

a smash-bros like game
Other
29 stars 4 forks source link

Remove Hard-Coded calculations #12

Open AphonicChaos opened 12 years ago

AphonicChaos commented 12 years ago

A lot of code is written with concrete "magic" numbers, which not only makes it difficult to update code, but makes it difficult to interpret existing code as well. These should be replaced with constants, and functions/methods that abstract the calculations so that algorithms may be changed when needed, without breaking the game.

A few examples (references using my fork):

This happens in plenty of other files as well, but as I was looking at the new camera implementation, it was easiest to point out the examples in game.py

tshirtman commented 12 years ago

I agree, there are those hard coded values all over the place, either we find computations not requiering them, or we try to keep them hard coded in as few places as possible (i.e. one time each).