[WIP] Dialeg
This commit is contained in:
40
data/dialeg.lua
Normal file
40
data/dialeg.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
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
|
||||||
@@ -20,6 +20,7 @@ require "bar_meter"
|
|||||||
|
|
||||||
require "stage1"
|
require "stage1"
|
||||||
require "remote_view"
|
require "remote_view"
|
||||||
|
require "dialeg"
|
||||||
|
|
||||||
local DEBUG = false
|
local DEBUG = false
|
||||||
|
|
||||||
@@ -272,8 +273,8 @@ function update_game()
|
|||||||
|
|
||||||
score.draw()
|
score.draw()
|
||||||
|
|
||||||
if DEBUG then
|
|
||||||
special_keys()
|
special_keys()
|
||||||
|
if DEBUG then
|
||||||
debug_info()
|
debug_info()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -381,9 +382,10 @@ function special_keys()
|
|||||||
print_analisis()
|
print_analisis()
|
||||||
end
|
end
|
||||||
if key.press(key.D) then
|
if key.press(key.D) then
|
||||||
boss.x_old = boss.x
|
-- boss.x_old = boss.x
|
||||||
boss.x = boss.x+1
|
-- boss.x = boss.x+1
|
||||||
print_analisis()
|
-- print_analisis()
|
||||||
|
dialeg_draw( "Hola mundo!", abad )
|
||||||
end
|
end
|
||||||
if key.press(key.W) then
|
if key.press(key.W) then
|
||||||
boss.y_old = boss.y
|
boss.y_old = boss.y
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ function mini.init()
|
|||||||
surf.cls(16)
|
surf.cls(16)
|
||||||
local a = 1 | 2
|
local a = 1 | 2
|
||||||
print(a)
|
print(a)
|
||||||
flow:executar("logo")
|
flow:executar("game")
|
||||||
end
|
end
|
||||||
|
|
||||||
function mini.update()
|
function mini.update()
|
||||||
|
|||||||
Reference in New Issue
Block a user