So I'm new in the arduino world but I have a grasp of object oriented programming, and decided to write a little library for running games on an arduino mega using a display. My question is, I'm creating an "Entity" class (to spawn multiple enemies, players, etc) outside the setup() and the loop() functions, so they dont overwrite themselfs when the program is running (don't know if there's a better way), and I want to store position information, like xPos and yPos, but I need to calculate a lot of other stuff based on those two variables, and creating more variables makes the code more easy to read/write.
But I don't know how this would affect the memory usage or speed, because I ran into some problems earlier when I tried to create a big array, it end up using like 300% of the dynamic memory, so I guess that when I declare a global byte, for example, the arduino allocates the whole memory as if you would use the biggest byte possible.
Sorry for bad english :s