[NEW] Llibre de tècniques

[NEW] Escena llibre
[NEW] El abad dispara en l'aire
This commit is contained in:
2026-04-04 11:41:54 +02:00
parent 73122ebb78
commit 42b4638567
6 changed files with 68 additions and 6 deletions

40
data/llibre.lua Normal file
View File

@@ -0,0 +1,40 @@
-- posició en el gif (tiles de 32)
llibre_gif_col = 7
llibre_gif_row = 3
llibre={name="llibre",hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=0,w=32,h=32}}
function llibre.init()
-- local habs={{33,8},{13,4},{51,9},{50,4},{42,7}}
-- local r=1+math.random(0,#habs-1)
-- llibre.hab=habs[r][1]
-- llibre.x=habs[r][2]*8
-- llibre.x=habs[r][2]
llibre.hab = 41
llibre.x = 10
llibre.y = 2
local world_x, world_y = coords.room_to_world(llibre.hab,llibre.x,llibre.y)
llibre.x=world_x-4
llibre.y=world_y-3
llibre.update=llibre.update
llibre.draw=llibre.draw
end
function llibre.draw()
local x = llibre_gif_col*llibre.w
local y = llibre_gif_row*llibre.h
local scr_x, scr_y = viewp:screen_coords( llibre.x, llibre.y )
draw.surf(x,y,llibre.w,llibre.h,scr_x,scr_y,llibre.w,llibre.h)
end
function llibre.update()
if llibre.hab==abad.hab then
if collision(abad,llibre) then
abad.objects.llibre=true
remove_actor(llibre)
start_scene(scenes.llibre_trobat)
end
end
end