Lua-不在Corona SDK中显示文本

Lua-不在Corona SDK中显示文本,sdk,lua,coronasdk,Sdk,Lua,Coronasdk,在我用Corona SDK创建的这个应用程序中,当你赢了,文本“you win”应该会出现,但不会出现。我可以发布所有的代码,但我不认为其余的代码会很有用,所以这里只提供了最基本的内容: _H = display.contentHeight; _W = display.contentWidth; mRand = math.random; o = 0; time_remain = 20; time_up = false; total_orbs = 45; total_secs = 20; read

在我用Corona SDK创建的这个应用程序中,当你赢了,文本“you win”应该会出现,但不会出现。我可以发布所有的代码,但我不认为其余的代码会很有用,所以这里只提供了最基本的内容:

_H = display.contentHeight;
_W = display.contentWidth;
mRand = math.random;
o = 0;
time_remain = 20;
time_up = false;
total_orbs = 45;
total_secs = 20;
ready = false;

local backGround = display.newImage("media/bg.png");

backGround.xScale = 2;
backGround.yScale = 2;

loseMSG = display.newText("You Lose!", _W/2, _H/2, nil, 50)
loseMSG.isVisible = false

winMSG = display.newText("You Win!", _W/2, _H/2, nil, 50)
winMSG.isVisible = false

local countdowntxt = display.newText(time_remain, 0, 0, native.systemFont, 60);
countdowntxt.xScale = .5; countdowntxt.yScale = .5;
countdowntxt:setReferencePoint(display.BottomRightReferencePoint);
countdowntxt.x = _W-20; display.y = _H-20;
countdowntxt:setTextColor(0, 0, 0)


function winLose(condition)
if (condition == "Win") then
    bgAlpha = display.newImage("media/bgAlpha.png");
    bgAlpha.xScale = 2;
    bgAlpha.yScale = 2; 
    winMSG.isVisible = true -- Here the win text should become visible, but doesn't
elseif (condition == "Fail") then
    bgAlpha = display.newImage("media/bgAlpha.png");
    bgAlpha.xScale = 2;
    bgAlpha.yScale = 2; 
    loseMSG.isVisible = true        
end
结束


知道为什么吗?

为什么字体值为零? 至少传递默认系统字体

loseMSG = display.newText("You Lose!", _W/2, _H/2, native.systemFont, 50)
winMSG = display.newText("You Win!", _W/2, _H/2, native.systemFont, 50)

你需要采取分而治之的方法

这行吗

winMSG = display.newText("You Win!", _W/2, _H/2, nil, 50)
winMSG.isVisible = true <-- note this is set to true
winMSG=display.newText(“你赢了!”,\u W/2,\u H/2,零,50)

winMSG.isVisible=true Lua不是首字母缩略词,而是一个名称。所以是Lua,不是Lua,除非你在大喊大叫。对不起,搞错了,trolling caps lock;)我也尝试使用native.systemFont,但结果是一样的,所以我决定使用图像。也许有点重,但更容易放置:)无论如何谢谢你的帮助