- Treballant en els bocadillos de text

This commit is contained in:
2023-01-30 19:05:07 +01:00
parent 3e608882c9
commit ce00e70c7b
3 changed files with 51 additions and 1 deletions

48
data/balloon.lua Normal file
View File

@@ -0,0 +1,48 @@
balloon={
text=nil,
height=0,
tail={pos=0,under=true},
pos=0,
cursor={x=0,y=0},
old_update=nil,
show=function(txt,height,tail)
balloon.text=txt
balloon.height=height
balloon.tail=tail
balloon.pos=0
balloon.cursor={x=0,y=0}
balloon.old_update=update
update=balloon.update
if balloon.tail.under then
rectfill(9,height-50,153,height-15,5)
rectfill(8,height-51,152,height-16,8)
rect(8,height-51,152,height-16,6)
local pos=balloon.tail.pos
if pos<80 then
for i=0,4 do rect(pos,height-16+(4-i),pos+i,height-16+(4-i),8) end
line(pos-1,height-15,pos-1,height-10,6)
line(pos+4,height-15,pos-1,height-10,6)
else
for i=0,4 do rect(pos+i,height-16+i,pos+4,height-16+i,8) end
line(pos+5,height-15,pos+5,height-10,6)
line(pos,height-15,pos+5,height-10,6)
end
end
text("12345678901234567890123456789012\n3",16,height-44, 2)
text("UNO DOS TRES",16,height-35, 2)
text("UNO DOS TRES",16,height-26, 2)
end,
draw=function()
if ballon.text then
end
end,
update=function()
end
}

View File

@@ -3,4 +3,4 @@ config=ja2
width=160 width=160
height=144 height=144
zoom=5 zoom=5
files=actors.lua,game.lua,mapa.lua,editor.lua,textbox.lua,menu.lua,main.lua files=balloon.lua,actors.lua,game.lua,mapa.lua,editor.lua,textbox.lua,menu.lua,main.lua

View File

@@ -23,6 +23,8 @@ game={
actors.draw() actors.draw()
camera(0,0) camera(0,0)
balloon.show("HOLA", hero.y*8, {pos=90,under=true})
if hero and not hero.path and hero.dx+hero.dy==0 then if hero and not hero.path and hero.dx+hero.dy==0 then
if btn(KEY_DOWN) then if btn(KEY_DOWN) then
hero.path={pos=0,route='d'} hero.path={pos=0,route='d'}