Commit 2e30ea53 authored by marykatefain's avatar marykatefain

open evelope on intro screen

parent bca90fb7
......@@ -4,10 +4,14 @@ local intro = {} -- menu object
-- Called when the intro is started with sol.menu.start(intro)
function intro:on_started()
log("we made it!")
log("Intro started")
-- Load graphics
self.envelope_closed_gfx = sol.sprite.create("menus/intro/envelope_closed")
self.envelope_open_gfx = sol.sprite.create("menus/intro/envelope_open")
self.envelope_open_gfx:hide()
-- Animation to shake envelope back and forth
function self.envelope_closed_gfx:shiver()
local m = sol.movement.create("pixel")
m:set_loop(true)
......@@ -19,21 +23,27 @@ function intro:on_started()
m:start(self)
end
-- Move envelope up screen and call shiver animation
local m = sol.movement.create("target")
m:set_target(0,-91) -- relative to self
m:set_speed(20)
m:start(self.envelope_closed_gfx, function()
self.envelope_closed_gfx:shiver()
sol.timer.start(1000, function()
-- shiver animation finished and removed
self.envelope_closed_gfx:stop_movement()
self.envelope_closed_gfx:hide()
self.envelope_open_gfx:show()
end)
end)
-- sol.menu.stop(intro)
end
-- Called every frame
function intro:on_draw(dst_surface)
dst_surface:fill_color({160,240,240})
self.envelope_closed_gfx:draw(dst_surface, 43, 150)
self.envelope_open_gfx:draw(dst_surface, 43, 3)
end
return intro
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment