rodot wrote:Well you should call gb.display.clear() before and after you use the display buffer to be sure it's clean.
You have to use the buffer within one frame, as it's updated onto the screen at the end of each frame. Also make sure you draw your sprites and tiles after you use and erase it.
Haha that's quite a short .ino indeed. I use notepad++ too to work on the Gamebuino library.
That makes sense. Flashing to memory upon loading the level may be the best course of action. Unless that expansion with the SPI RAM is coming out soon
Do you use any notepad++ extensions? Something to auto-complete the gb calls, maybe?
Oh, and I wanted to share this part because I thought it was neat... but also because I need some help. In my game, each tile is 4 bits, giving me 16 different tile IDs. But, I dynamically assign the sprites to tiles--that is, rather than using one tile ID for each block type (left corner, right corner, top, interior/wall), I only have one block tile ID stored in the map data. I check for neighboring blocks to decide if it's a corner, top, or interior block. Same thing for trees--there is really only one tree tile ID, but the sprite it draws (top, middle, and trunk) is based off of neighboring tree tiles. That way I'm not wasting 4 tile IDs on blocks and 3 tile IDs on trees. My maps can have a lot of variety with very little memory usage. Unfortunately, I have to access the PROGMEM ~4 times per block to check the neighbors.
I seem to recall something about how arrays are accessed--that if you're traversing an array sequentially, it's faster than jumping around a lot (which I'm doing--when I read a tile above or below, that's jumping to a non-adjacent part of the array). How can I make that faster? Would making it a 2D array help at all? Or does that really only apply to architectures with a true memory hierarchy with registers, L1/L2/L3 caches, etc?
Alas, we programmers must always decide between CPU efficiency and RAM efficiency