annyfm wrote:Limited wrote:Out of curiosity is there a reason why you use floats for positions and velocities for bullets rather than bytes? (Bytes usage is better)
Ignorance
edit: will expand on that a little... I'm not really a C or Arduino programmer, I actually come from a predominantly PHP background (which is how I make my living) and while I understand static tying in principle and casting, working in a dynamically typed language leaves me somewhat at a loss for the pros and cons of certain types (like I know float is more computationally expensive than int, but not a lot more than that!)
edit 2: on that note, any chance you could elucidate the benefits of byte over int/float?
Thats fair enough, first stage is what you've done, get the thing working first, then plan out improving.
The short answer is bytes take up less room, there are 8 bits in a byte, 16 in an int and 32 in a float - the more bits it takes up more memory, but does allow you to store larger numbers.
Floats are very bad for low processor powered devices because multiplying but more importantly dividing is extremely costly computationally, float numbers allow for decimal places, for like 3.14 etc, the program would also have to cast/convert these into ints as that is what the screen uses for pixel rendering for instance.