- Els bocadillos poden estar dalt o baix del actor
- Text apareix lletra a lletra - Salt de linea acceptat
This commit is contained in:
@@ -1,40 +1,62 @@
|
|||||||
balloon={
|
balloon={
|
||||||
text=nil,
|
text=nil,
|
||||||
height=0,
|
pos=1,
|
||||||
tail={pos=0,under=true},
|
|
||||||
pos=0,
|
|
||||||
cursor={x=0,y=0},
|
cursor={x=0,y=0},
|
||||||
old_update=nil,
|
old_update=nil,
|
||||||
|
|
||||||
show=function(txt,height,tail)
|
show=function(txt,actorname,below)
|
||||||
|
local actor = actors.search(actorname)
|
||||||
|
if not actor then return end
|
||||||
|
|
||||||
balloon.text=txt
|
balloon.text=txt
|
||||||
balloon.height=height
|
balloon.pos=1
|
||||||
balloon.tail=tail
|
|
||||||
balloon.pos=0
|
|
||||||
balloon.cursor={x=0,y=0}
|
|
||||||
balloon.old_update=update
|
balloon.old_update=update
|
||||||
update=balloon.update
|
update=balloon.update
|
||||||
|
|
||||||
if balloon.tail.under then
|
local pos,height=actor.x*8+4,actor.y*8-4
|
||||||
rectfill(9,height-50,153,height-15,5)
|
|
||||||
rectfill(8,height-51,152,height-16,8)
|
if below==nil or below==false then
|
||||||
rect(8,height-51,152,height-16,6)
|
height=height-51
|
||||||
|
rectfill(9,height+1,153,height+36,5)
|
||||||
|
rectfill(8,height,152,height+35,8)
|
||||||
|
rect(8,height,152,height+35,6)
|
||||||
|
|
||||||
local pos=balloon.tail.pos
|
|
||||||
if pos<80 then
|
if pos<80 then
|
||||||
for i=0,4 do rect(pos,height-16+(4-i),pos+i,height-16+(4-i),8) end
|
for i=0,4 do rect(pos,height+35+(4-i),pos+i,height+35+(4-i),8) end
|
||||||
line(pos-1,height-15,pos-1,height-10,6)
|
line(pos-1,height+36,pos-1,height+41,6)
|
||||||
line(pos+4,height-15,pos-1,height-10,6)
|
line(pos+4,height+36,pos-1,height+41,6)
|
||||||
else
|
else
|
||||||
for i=0,4 do rect(pos+i,height-16+i,pos+4,height-16+i,8) end
|
pos=pos-5
|
||||||
line(pos+5,height-15,pos+5,height-10,6)
|
for i=0,4 do rect(pos+i,height+35+i,pos+4,height+35+i,8) end
|
||||||
line(pos,height-15,pos+5,height-10,6)
|
line(pos+5,height+36,pos+5,height+41,6)
|
||||||
|
line(pos,height+36,pos+5,height+41,6)
|
||||||
end
|
end
|
||||||
|
height=height+7
|
||||||
|
else
|
||||||
|
height=height+16
|
||||||
|
rectfill(9,height+1,153,height+35,5)
|
||||||
|
rectfill(8,height,152,height+36,8)
|
||||||
|
rect(8,height,152,height+36,6)
|
||||||
|
|
||||||
|
if pos<80 then
|
||||||
|
for i=0,4 do rect(pos,height-(4-i),pos+i,height-(4-i),8) end
|
||||||
|
line(pos-1,height,pos-1,height-6,6)
|
||||||
|
line(pos+5,height,pos-1,height-6,6)
|
||||||
|
else
|
||||||
|
pos=pos-5
|
||||||
|
for i=0,4 do rect(pos+i,height-i,pos+4,height-i,8) end
|
||||||
|
line(pos+5,height,pos+5,height-6,6)
|
||||||
|
line(pos-1,height,pos+5,height-6,6)
|
||||||
end
|
end
|
||||||
|
|
||||||
text("12345678901234567890123456789012\n3",16,height-44, 2)
|
height=height+7
|
||||||
text("UNO DOS TRES",16,height-35, 2)
|
end
|
||||||
text("UNO DOS TRES",16,height-26, 2)
|
|
||||||
|
balloon.cursor={x=16,y=height}
|
||||||
|
--text("12345678901234567890123456789012\n3",16,height, 2)
|
||||||
|
--text("UNO DOS TRES",16,height+9, 2)
|
||||||
|
--text("UNO DOS TRES",16,height+18, 2)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
draw=function()
|
draw=function()
|
||||||
@@ -44,5 +66,21 @@ balloon={
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
update=function()
|
update=function()
|
||||||
|
if not beat() then return end
|
||||||
|
|
||||||
|
local char=string.sub(balloon.text,balloon.pos,balloon.pos)
|
||||||
|
if char=='' then
|
||||||
|
-- final
|
||||||
|
update=balloon.old_update
|
||||||
|
elseif char=='\n' then
|
||||||
|
-- salt de linea
|
||||||
|
balloon.pos=balloon.pos+1
|
||||||
|
balloon.cursor.x=16
|
||||||
|
balloon.cursor.y=balloon.cursor.y+9
|
||||||
|
else
|
||||||
|
text(char,balloon.cursor.x,balloon.cursor.y,2)
|
||||||
|
balloon.pos=balloon.pos+1
|
||||||
|
balloon.cursor.x=balloon.cursor.x+4
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ game={
|
|||||||
actors.draw()
|
actors.draw()
|
||||||
camera(0,0)
|
camera(0,0)
|
||||||
|
|
||||||
balloon.show("HOLA", hero.y*8, {pos=90,under=true})
|
balloon.show("HOLA\nQUE TAL?", "usufondo",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
|
||||||
|
|||||||
Reference in New Issue
Block a user