Log In  


Cart #guzuzetoje-2 | 2019-08-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8


Press any key to switch between self-aware tiles and non-aware tiles.

8


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.


I didn't know that. Thanks!


3

Cart #tayuhapusi-0 | 2020-02-08 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

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


I don’t really get what this is about. Could you say more?


@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]