- WIP animated tiles

This commit is contained in:
2022-10-24 15:01:47 +02:00
parent 86a9d3d915
commit adc89cf11c
5 changed files with 419 additions and 393 deletions

View File

@@ -72,7 +72,7 @@ function update_dialog()
_update=update_game
end
end
scroll=0
function update_game()
cls(16)
@@ -80,7 +80,7 @@ function update_game()
draw_hab(abad.hab,0,0,true)
text(abad.hab,120,1,2)
sspr(0,64,128,48,0,48)
sspr(0,64+scroll*8,128,48,0,48)
color(3)
local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8
@@ -88,6 +88,7 @@ function update_game()
text("EDIT",100,1,3)
local hx = abad.hab%10
local hy = flr(abad.hab/10)
scroll=0
if btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btnp(KEY_LEFT) and hx>0 then
@@ -104,6 +105,9 @@ function update_game()
elseif btnp(KEY_C) then
mapa_cycle_colors(abad.hab)
end
if btn(KEY_TAB) then
scroll=2
end
local mx,my=mousex(),mousey()
if mx>>3 < 12 and my>>3 < 6 then
@@ -113,13 +117,13 @@ function update_game()
end
if mbtn(1) then
if my>=48 then
seltile=(mx>>3)+((my-48)>>3)*16
seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16
elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end
elseif mbtn(3) then
if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,255)
mapa_set_tile(abad.hab,mx>>3,my>>3,256)
end
end
if mx>>3 < 12 and my>>3 < 6 then
@@ -130,11 +134,14 @@ function update_game()
draw_hab(abad.hab,0,0)
text(abad.hab,1,1,2)
draw_hab(premiere.hab,0,48)
text("Premiere",2,49,2)
score.draw()
setsource(tiles)
prnt("x"..abad.vides,114,13,2)
rectfill(102+(abad.energia>>1),30,122,37,16)
mapa_update()
for key,actor in pairs(actors) do
actor:update()
if actor.hab==cacau.hab and actor~=abad then