Press any key to switch between self-aware tiles and non-aware tiles.
This is really cool! Nice work.
BTW, you can condense your whole _update60() function into:
function _update60() if (btnp()>0) m.draw_mapped*=-1 end |
Using btnp(), with no parameters, returns a bitmask of the buttons being pressed.
Here's my take on this idea, based on your code.
changes in this version:
automatically generate lookup tables
support separate lookups for both types of tile ("land" and "water")
create and save template spritesheet
@merwok the idea is that you can lay out a grid of simple tiles (in these examples, just ones and zeros), then the code will figure out which of many sprites to use based on the neighbors of each cell.
1 surrounded by 1 is solid land. 1 surrounded by 0 is a small island.
000 111 000 |
is an east/west bridge
That is awesome! I knew someone smarter than me could optimize this. My original idea was to combine this with this cart for a continuously generated world. I just have been distracted by work and life. I might have to pick this up again. Thanks!
Aha! Thanks for the explanation. I remember reading about this technique but forget if it was on this BBS or on a gamedev blog.
[Please log in to post a comment]