-
Notifications
You must be signed in to change notification settings - Fork 3
/
level.lua
62 lines (44 loc) · 1.52 KB
/
level.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- Include modules/libraries
local composer = require( 'composer' )
local berry = require( 'ldurniat.berry' )
local physics = require( "physics" )
-- Create a new Composer scene
local scene = composer.newScene()
-- This function is called when scene is created
function scene:create( event )
local sceneGroup = self.view -- Add scene display objects to this group
physics.start( )
physics.setDrawMode( 'hybrid' )
-- Load our map
-- 1. Use of pivot joint plugin
map = berry:new( 'examples/pivot_joints/map/map.json', 'examples/pivot_joints/map' )
map:extend( 'pivot_joint' )
-- 2. Load images and tileset
-- map = berry:new( 'examples/images_and_tileset/map/level.json', 'examples/images_and_tileset/map' )
scene.view:insert( map )
end
-- This function is called when scene comes fully on screen
function scene:show( event )
local phase = event.phase
if phase == 'will' then
elseif phase == 'did' then
-- Start playing wind sound
-- For more details on options to play a pre-loaded sound, see the Audio Usage/Functions guide:
-- https://docs.coronalabs.com/guide/media/audioSystem/index.html
end
end
-- This function is called when scene goes fully off screen
function scene:hide( event )
local phase = event.phase
if phase == 'will' then
elseif phase == 'did' then
end
end
-- This function is called when scene is destroyed
function scene:destroy( event )
end
scene:addEventListener( 'create' )
scene:addEventListener( 'show' )
scene:addEventListener( 'hide' )
scene:addEventListener( 'destroy' )
return scene