- Sistema d'objectes funcionant
This commit is contained in:
@@ -6,7 +6,7 @@ balloon={
|
||||
old_update=nil,
|
||||
rect=nil,
|
||||
|
||||
show=function(txt,actorname,below,rectangle)
|
||||
show=function(txt,col,actorname,below,rectangle)
|
||||
local actor = actors.search(actorname)
|
||||
if not actor then return end
|
||||
|
||||
@@ -21,13 +21,15 @@ balloon={
|
||||
end
|
||||
|
||||
balloon.text=txt
|
||||
balloon.color=col
|
||||
balloon.pos=1
|
||||
balloon.ini=1
|
||||
balloon.obj=nil
|
||||
|
||||
balloon.old_update=update
|
||||
update=balloon.update
|
||||
|
||||
local pos,height=actor.x*8+4,actor.y*8-4
|
||||
local pos=actor.x*8+4
|
||||
|
||||
if below==nil or below==false then
|
||||
balloon.rect.y=balloon.rect.y-balloon.rect.h-16
|
||||
@@ -46,7 +48,6 @@ balloon={
|
||||
line(pos+5,y+h+1,pos+5,y+h+6,6)
|
||||
line(pos,y+h+1,pos+5,y+h+6,6)
|
||||
end
|
||||
height=height+7
|
||||
else
|
||||
balloon.rect.y=balloon.rect.y+16
|
||||
local x,y,w,h=balloon.rect.x,balloon.rect.y,balloon.rect.w,balloon.rect.h
|
||||
@@ -64,13 +65,28 @@ balloon={
|
||||
line(pos+5,y,pos+5,y-6,6)
|
||||
line(pos-1,y,pos+5,y-6,6)
|
||||
end
|
||||
height=height+7
|
||||
end
|
||||
|
||||
balloon.cursor={x=balloon.rect.x+8,y=balloon.rect.y+7}
|
||||
--text("12345678901234567890123456789012\n3",16,height, 2)
|
||||
--text("UNO DOS TRES",16,height+9, 2)
|
||||
--text("UNO DOS TRES",16,height+18, 2)
|
||||
end,
|
||||
|
||||
narrator=function(obj)
|
||||
balloon.rect={x=8,y=48,w=144,h=35}
|
||||
balloon.text="HAS ACONSEGUIT:\n"..obj.name.."!"
|
||||
balloon.color=8
|
||||
balloon.pos=1
|
||||
balloon.ini=1
|
||||
balloon.obj=obj
|
||||
|
||||
balloon.old_update=update
|
||||
update=balloon.update
|
||||
|
||||
local x,y,w,h=balloon.rect.x,balloon.rect.y,balloon.rect.w,balloon.rect.h
|
||||
rectfill(x+1,y+1,x+w+1,y+h+1,5)
|
||||
rectfill(x,y,x+w,y+h,15)
|
||||
rect(x,y,x+w,y+h,6)
|
||||
|
||||
balloon.cursor={x=balloon.rect.x+12,y=balloon.rect.y+11}
|
||||
end,
|
||||
|
||||
update=function()
|
||||
@@ -82,6 +98,10 @@ balloon={
|
||||
if not beat() then return end
|
||||
|
||||
if balloon.pos<0 then
|
||||
if balloon.obj then
|
||||
setsource(objectes)
|
||||
sspr(balloon.obj.x,balloon.obj.y,16,16,balloon.rect.x+balloon.rect.w-28,balloon.rect.y+10)
|
||||
end
|
||||
local col=8
|
||||
if flr(time()*4)%2==0 then col=10 end
|
||||
local x,y=balloon.rect.x+balloon.rect.w-8, balloon.rect.y+balloon.rect.h-6
|
||||
@@ -105,7 +125,7 @@ balloon={
|
||||
--balloon.cursor.x=balloon.rect.x+8
|
||||
balloon.cursor.y=balloon.cursor.y+9
|
||||
else
|
||||
text(txt,balloon.cursor.x,balloon.cursor.y,2)
|
||||
text(txt,balloon.cursor.x,balloon.cursor.y,balloon.color)
|
||||
balloon.pos=balloon.pos+1
|
||||
--balloon.cursor.x=balloon.cursor.x+4
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user