40 lines
965 B
Lua
40 lines
965 B
Lua
function dialog.new( _text, _actor )
|
|
return {
|
|
actor = _actor,
|
|
text = _text,
|
|
time = 60,
|
|
}
|
|
end
|
|
|
|
function dialeg:draw( )
|
|
local w = 50
|
|
local h = 20
|
|
local x = 0
|
|
local y = 0
|
|
|
|
y = actor.y-20
|
|
if actor.flip then
|
|
x = actor.x-w
|
|
else
|
|
x = actor.x+actor.w
|
|
end
|
|
|
|
x, y = viewp:screen_coords( x, y )
|
|
draw.rrectf(x, y, w, h, 5, 2)
|
|
if actor.flip then
|
|
draw.line(x+w, y+h-1+5, x+w-20, y+h-1, 2)
|
|
draw.line(x+w, y+h-1+5, x+w-18, y+h-1, 2)
|
|
draw.line(x+w, y+h-1+5, x+w-14, y+h-1, 2)
|
|
draw.line(x+w, y+h-1+5, x+w-12, y+h-1, 2)
|
|
else
|
|
draw.line(x, y+h-1+5, x+20, y+h-1, 2)
|
|
draw.line(x, y+h-1+5, x+18, y+h-1, 2)
|
|
draw.line(x, y+h-1+5, x+14, y+h-1, 2)
|
|
draw.line(x, y+h-1+5, x+12, y+h-1, 2)
|
|
end
|
|
|
|
local font_curr = font.current()
|
|
font.current(font_default)
|
|
draw.text(text, x+5,y+7, 16)
|
|
font.current(font_curr)
|
|
end |