Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Writing code like this is very convenient, let's make it work!
- function cutScene()
- john:say( "What a sunny day" );
- mary:say( "Wanna go fishing?" );
- john:setAnim( "hesitation" );
- wait( 2 );
- john:say( "Ok" );
- end
- function love.draw()
- john:draw();
- mary:draw();
- dialogBox:draw();
- end
- function love.load()
- script = coroutine.create( cutScene );
- end
- function love.update()
- john:update();
- mary:update();
- dialogBox:update();
- coroutine.resume( script );
- end
- function wait( duration )
- local start = timer.now();
- while true do
- if timer.now() > start + duration then
- break;
- else
- coroutine.yield();
- end
- end
- end
- function say( text )
- dialogBox:startDisplaying( text );
- while not dialogBox:finishedDisplaying() do
- coroutine.yield();
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement