diff --git a/data/dialeg.lua b/data/dialeg.lua new file mode 100644 index 0000000..8fd4b85 --- /dev/null +++ b/data/dialeg.lua @@ -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 \ No newline at end of file diff --git a/data/game.lua b/data/game.lua index 3524ebd..83bdb81 100644 --- a/data/game.lua +++ b/data/game.lua @@ -20,6 +20,7 @@ require "bar_meter" require "stage1" require "remote_view" +require "dialeg" local DEBUG = false @@ -272,8 +273,8 @@ function update_game() score.draw() - if DEBUG then special_keys() + if DEBUG then debug_info() end end @@ -381,9 +382,10 @@ function special_keys() print_analisis() end if key.press(key.D) then - boss.x_old = boss.x - boss.x = boss.x+1 - print_analisis() + -- boss.x_old = boss.x + -- boss.x = boss.x+1 + -- print_analisis() + dialeg_draw( "Hola mundo!", abad ) end if key.press(key.W) then boss.y_old = boss.y diff --git a/data/main.lua b/data/main.lua index de78e33..57adc2c 100644 --- a/data/main.lua +++ b/data/main.lua @@ -90,7 +90,7 @@ function mini.init() surf.cls(16) local a = 1 | 2 print(a) - flow:executar("logo") + flow:executar("game") end function mini.update()