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.

P#67042 2019-08-30 15:16 ( Edited 2019-08-30 20:14)

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.

P#67043 2019-08-30 17:27

I didn't know that. Thanks!

P#67046 2019-08-30 18:13
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

P#72905 2020-02-08 04:38

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

P#72926 2020-02-09 05:10

@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

P#72928 2020-02-09 08:21

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!

P#72931 2020-02-09 14:16

Aha! Thanks for the explanation. I remember reading about this technique but forget if it was on this BBS or on a gamedev blog.

P#72989 2020-02-11 18:33

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 19:49:45 | 0.027s | Q:29