我正在尝试将目录与“食谱”示例一起使用。我的计时器有问题
在我运行该main.lua
页面后,它应该显示我的徽标和欢迎按摩,然后它应该转到介绍页面,我有一个屏幕来获取用户名和手机,只有当他第一次使用该应用程序并将其保存到 txt 文件中,然后下次它会检查那个txt文件..
接下来,它将指向用户可以从中选择的“菜单”页面
我的问题是main.lua
我使用计时器来显示徽标,但是这个计时器在其他屏幕上仍然有效。
Main.lua (cdoe)
_w = display.viewableContentWidth
_h = display.viewableContentHeight
local background = display.newRect(0,0,_w,_h)
background:setFillColor( 234, 234, 234 )
local obj = display.newImage( "ams_logo.jpg" )
-- center the object
obj.x = display.contentWidth*0.5
obj.y = display.contentHeight*0.5
-- fade object to completely transparent
local transition_id = transition.from( obj, { time=2000, alpha=0 } )
--local textObject = display.newText( "Welcome to AMS project", 20, 350, native.systemFont, 24 )
local textObject = display.newText( "Welcome to AMS project", _w*.1, _h*.8, native.systemFont, 24 )
textObject:setTextColor( 255,144,0 )
local transition_id = transition.from( textObject, { time=1500, alpha=0 })
function changeScene (e)
if(e.phase == "ended") then
director:changeScene(e.target.scene)
end
end
local director = require("director");
local mainGroup = display.newGroup();
mainGroup:insert(director.directorView);
display.setStatusBar(display.HiddenStatusBar) _W = display.contentWidth _H = display.contentHeight number = 0
function fn_counter()
director:changeScene("intro");
end
timer.performWithDelay(5500, fn_counter, 0)
the intro .lua
module(..., package.seeall)
function new()
local introGroup = display.newGroup();
local background = display.newImage("graphics/intro_background.png")
local begin = display.newImage("graphics/begin_button.png")
begin.x = 160;
begin.y = 400;
begin.scene = "menu";
introGroup:insert(background);
introGroup:insert(begin);
begin:addEventListener("touch", changeScene);
return introGroup;
end
请帮我 ..