- aScene.map=myMap
- aScene.tempX=0
- aScene.tempY=0
- RNListeners:addEventListener("touch",aScene.touchListener)
- function aScene.touchListener(event)
- if event.phase=="began" then
- aScene.tempX,aScene.tempY= event.x,event.y
- end
- if event.phase=="moved" then
- local deltaX= getDelta(tempX,event.x)
- local deltaY= getDelta(tempY,event.y)
- aScene.map.x= aScene.map.x - deltaX
- aScene.map.y= aScene.map.y - deltaY
- tempX,tempY= event.x,event.y
- end
- end
-
- --[[
-
- SCENES MUST HAVE
- 1)a sceneGroup where all instances are inserted
- 2)onCreate function in which we create everything
- 3)onEnd function in which we clean the instance
-
- ]] --
-
- aScene = {}
-
- local sceneGroup = RNGroup:new()
-
- aScene.map = RNFactory.createImage("assets/images/map/map_bg_01.jpg")
- aScene.tempX = 0
- aScene.tempY = 0
-
- function aScene.touchListener(event)
- print("Touch")
- if event.phase=="began" then
- aScene.tempX,aScene.tempY= event.x,event.y
- end
- if event.phase=="moved" then
- local deltaX= getDelta(tempX,event.x)
- local deltaY= getDelta(tempY,event.y)
- aScene.map.x= aScene.map.x - deltaX
- aScene.map.y= aScene.map.y - deltaY
- tempX,tempY= event.x,event.y
- end
- end
-
- RNListener:addEventListener("touch",aScene.touchListener)
-
- --init Scene
- function aScene.onCreate()
- local button1 = RNFactory.createAnim("assets/images/sceneButtons.png", 128, 64)
- button1.frame = 1
- button1.x = 1024; button1.y = 768
- button1:setOnTouchDown(button1Down)
- button1:setOnTouchUp(button1Up)
-
- sceneGroup:insert(button1)
- sceneGroup:bringToFront(button1)
-
-
- return sceneGroup
- end
-
- function button1Down(event)
- event.target.frame = 2
- end
-
- function button1Up(event)
- event.target.frame = 1
- director:showScene("scenes/title_scene", "fade")
- end
-
- function aScene.onEnd()
- sceneGroup:remove()
- end
-
- return aScene
-
-
- lua/scenes/map_scene.lua:32: attempt to index global 'RNListener' (a nil value)
- stack traceback:
- lua/scenes/map_scene.lua:32 in main chunk
- [C] in function 'require'
- rapanui/rapanui-sdk/RNDirector.lua:81 in function 'showScene'
- lua/scenes/title_scene.lua:61 in function 'onTouchUpListener'
- rapanui/rapanui-sdk/RNObject.lua:1184 in function 'onEvent'
- rapanui/rapanui-sdk/RNInputManager.lua:400 in function 'onEvent'
- rapanui/rapanui-sdk/RNInputManager.lua:224 in function <rapanui/rapanui-sdk/RNInputManager.lua:215>
-
- aScene = {}
-
- local sceneGroup = RNGroup:new()
-
-
-
- function aScene.touchListener(event)
- print("Touch")
- if event.phase=="began" then
- aScene.tempX,aScene.tempY= event.x,event.y
- end
- if event.phase=="moved" then
- local deltaX= getDelta(tempX,event.x)
- local deltaY= getDelta(tempY,event.y)
- aScene.map.x= aScene.map.x - deltaX
- aScene.map.y= aScene.map.y - deltaY
- tempX,tempY= event.x,event.y
- end
- end
-
-
- --init Scene
- function aScene.onCreate()
- aScene.map = RNFactory.createImage("assets/images/map/map_bg_01.jpg")
- aScene.tempX = 0
- aScene.tempY = 0
-
- sceneGroup:insert(aScene.map)
-
- local button1 = RNFactory.createAnim("assets/images/sceneButtons.png", 128, 64)
- button1.frame = 1
- button1.x = 1024; button1.y = 768
- button1:setOnTouchDown(button1Down)
- button1:setOnTouchUp(button1Up)
-
- sceneGroup:insert(button1)
- sceneGroup:bringToFront(button1)
-
- aScene.tListener=RNListeners:addEventListener("touch",aScene.touchListener)
-
- return sceneGroup
- end
-
- function button1Down(event)
- event.target.frame = 2
- end
-
- function button1Up(event)
- event.target.frame = 1
- director:showScene("scenes/title_scene", "fade")
- end
-
- function aScene.onEnd()
- RNListeners:removeEventListener("touch", aScene.tListener)
- sceneGroup:remove()
- end
-
- return aScene
- RNListeners:removeEventListener("touch", aScene.tListener)
- rapanui/rapanui-sdk/RNInputManager.lua:157: attempt to perform arithmetic on local 'id' (a nil value)
- stack traceback:
- rapanui/rapanui-sdk/RNInputManager.lua:157 in function <rapanui/rapanui-sdk/RNInputManager.lua:151>
- (tail call) ?
- rapanui/rapanui-sdk/RNListeners.lua:53 in function 'removeEventListener'
- lua/scenes/map_scene.lua:61 in function 'onEnd'
- rapanui/rapanui-sdk/RNDirector.lua:273 in function 'onComplete'
- rapanui/rapanui-sdk/RNTransition.lua:253 in function <rapanui/rapanui-sdk/RNTransition.lua:253>
- function aScene.eventChangingScene()
- if director:isTransitioning()==false then
- director:changeScene("nextScene","myMode")
- end
- end
- --[[
-
- SCENES MUST HAVE
- 1)a sceneGroup where all instances are inserted
- 2)onCreate function in which we create everything
- 3)onEnd function in which we clean the instance
-
- ]] --
-
- aScene = {}
-
- local sceneGroup = RNGroup:new()
-
- function sceneGroup.touchListener(event)
- if event.phase=="began" then
- sceneGroup.tempX, sceneGroup.tempY= event.x,event.y
- end
- if event.phase=="moved" then
- local deltaX = sceneGroup.tempX - event.x
- local deltaY = sceneGroup.tempY - event.y
- sceneGroup.map.x= sceneGroup.map.x - .1*deltaX
- sceneGroup.map.y= sceneGroup.map.y - .1*deltaY
- tempX,tempY= event.x,event.y
- end
- end
-
- --init Scene
- function aScene.onCreate()
- sceneGroup.map = RNFactory.createImage("assets/images/map/map_bg_01.jpg")
- sceneGroup.map:sendToBottom()
- sceneGroup.tempX = 0
- sceneGroup.tempY = 0
- sceneGroup:insert(sceneGroup.map)
-
- local button1 = RNFactory.createAnim("assets/images/sceneButtons.png", 128, 64)
- button1.frame = 1
- button1.x = 1024; button1.y = 768
- button1:setOnTouchDown(button1Down)
- button1:setOnTouchUp(button1Up)
-
- sceneGroup:insert(button1)
- sceneGroup:bringToFront(button1)
-
- sceneGroup.touchID=RNListeners:addEventListener("touch", sceneGroup.touchListener, "mapListener")
-
- return sceneGroup
- end
-
- function button1Down(event)
- event.target.frame = 2
- end
-
- function button1Up(event)
- event.target.frame = 1
- if director:isTransitioning() == false then
- director:showScene("scenes/title_scene", "fade")
- end
- end
-
- function aScene.onEnd()
- RNListeners:removeEventListener("touch", sceneGroup.touchID)
- sceneGroup:remove()
- end
-
- return aScene
-
- aScene = {}
-
- local sceneGroup = RNGroup:new()
-
- function sceneGroup.touchListener(event)
- if event.phase=="began" then
- sceneGroup.tempX, sceneGroup.tempY= event.x,event.y
- end
- if event.phase=="moved" then
- local deltaX = sceneGroup.tempX - event.x
- local deltaY = sceneGroup.tempY - event.y
- sceneGroup.map.x= sceneGroup.map.x - .05*deltaX
- sceneGroup.map.y= sceneGroup.map.y - .05*deltaY
- tempX,tempY= event.x,event.y
- end
- end
-
- --init Scene
- function aScene.onCreate()
- sceneGroup.map = RNGroup:new()
- local tile1 = RNFactory.createImage("assets/images/map/map_bg_01.jpg")
- tile1.x = 0; tile1.y = 0;
- local tile2 = RNFactory.createImage("assets/images/map/map_bg_02.jpg")
- tile2.x = 1024; tile2.y = 0;
- local tile3 = RNFactory.createImage("assets/images/map/map_bg_03.jpg")
- tile3.x = 2048; tile3.y = 0;
- local tile4 = RNFactory.createImage("assets/images/map/map_bg_04.jpg")
- tile4.x = 0; tile4.y = 768;
- local tile5 = RNFactory.createImage("assets/images/map/map_bg_05.jpg")
- tile5.x = 1024; tile5.y = 768;
- local tile6 = RNFactory.createImage("assets/images/map/map_bg_06.jpg")
- tile6.x = 2048; tile6.y = 768;
- sceneGroup.map:insert(tile1)
- sceneGroup.map:insert(tile2)
- sceneGroup.map:insert(tile3)
- sceneGroup.map:insert(tile4)
- sceneGroup.map:insert(tile5)
- sceneGroup.map:insert(tile6)
- sceneGroup.map.x = 512; sceneGroup.map.y = 384
-
- sceneGroup.tempX = 0
- sceneGroup.tempY = 0
- sceneGroup:insert(sceneGroup.map)
-
- local button1 = RNFactory.createAnim("assets/images/sceneButtons.png", 128, 64)
- button1.frame = 1
- button1.x = 1024; button1.y = 768
- button1:setOnTouchDown(button1Down)
- button1:setOnTouchUp(button1Up)
-
- sceneGroup:insert(button1)
- button1:bringToFront()
- --sceneGroup:bringToFront(button1)
-
- sceneGroup.touchID=RNListeners:addEventListener("touch", sceneGroup.touchListener, "mapListener")
-
- return sceneGroup
- end
-
-
- function button1Down(event)
- event.target.frame = 2
- end
-
- function button1Up(event)
- event.target.frame = 1
- if director:isTransitioning() == false then
- director:showScene("scenes/title_scene", "fade")
- end
- end
-
- function aScene.onEnd()
- RNListeners:removeEventListener("touch", sceneGroup.touchID)
- sceneGroup:remove()
- end
-
-
- return aScene
- button1:setLevel(value)
- button1:setLevel(99999)
- RNGroup:flattern(value)
- E:\MyMoai\TarTest>d:\moai-sdk\bin\win32\moai.exe "d:\MyMoai\TarTest\config.lua" "E:\MyMoai\TarTest\main.lua "
- E:\MyMoai\TarTest\main.lua :2: module 'rapanui-sdk/rapanui' not found:
- no field package.preload['rapanui-sdk/rapanui']
- no file 'C:\Program Files\Lua\5.1\lua\rapanui-sdk/rapanui.luac'
- no file '.\rapanui-sdk/rapanui.dll'
- no file 'd:\moai-sdk\bin\win32\rapanui-sdk/rapanui.dll'
- no file 'd:\moai-sdk\bin\win32\loadall.dll'
- stack traceback:
- [C] in function 'require'
- E:\MyMoai\TarTest\main.lua :2 in main chunk
-
Users browsing this forum: No registered users and 0 guests