第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么說我的addEventWithSceneGraphPriority是空值

MainScene.lua

local Snake = require"app.Snake"



local MainScene = class("MainScene", function()

return display.newScene("MainScene")

end)


local cMovespeed = 0.3



function MainScene:onEnter()

self.snake = Snake.new(self)

self:processInput()

local tick = function()

self.snake:Update()

end

cc.Director:getInstance():getScheduler():scheduleScriptFunc(tick,cMovespeed,false)


end


local function vector2Dir(x,y)


if math.abs(x) > math.abs(y) then

if x<0 then

return "left"

else

return "right"

end

else

if Y < 0 then

return "up"

else

return "down"

end

end

end

function MainScene:processInput()

local function onTouchBegan(touch, event)

local location = touch:getLocation()

local visibleSize = cc.Director:getInstance():getVisibleSize()

local origin = cc.Director:getInstance():getVisibleOrigin()

local finaX = location.x - (origin.x + visibleSize.width/2)

local finaY = location.y - (origin.y + visibleSize.height/2)

local dir = vector2Dir(finaX,finaY)

self.snake:SetDir(dir)

end

local listener = cc.EventListenerTouchOneByOne:create()

listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN)

local eventDispatcher = self:getEventDispatcher()

eventDispatcher:addEventWithSceneGraphPriority(listener,self)


end


function MainScene:onExit()

end



return MainScene


正在回答

1 回答

是addEventListenerWithSceneGraphPriority

0 回復 有任何疑惑可以回復我~
#1

慕絲8128172 提問者

非常感謝!
2016-10-18 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么說我的addEventWithSceneGraphPriority是空值

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號