2016-11-20 36 views
0

我不知道我是在做一些愚蠢的事情还是在Corona模拟器中有一个错误。当我写下面的代码:电晕模拟器的锚点Y

rect = display.newRect(0, 0, 100, 100) 
rect.anchorX = 0 
rect.anchorY = 0 
rect.x = 0 
rect.y = 0 

这只是设置一个100x100正方形的锚点,它的左上角,并将位置设置为0,0。这应该使广场在角落舒适,但相反,它产生this。它在Y轴上总是有点过低,但X轴功能正常。有没有人有这方面的修复?

回答

1

与我的电晕模拟器(build 2016.2992)代码按预期工作。

main.lua 

--------------------------------------------- 

local rect = display.newRect(0, 0, 100, 100) 
rect.anchorX = 0 
rect.anchorY = 0 

首先检查你的config.lua文件。我认为这取决于显示分辨率。例如,在letterbox模式下,您可能在宽高比与内容宽高比不同的设备上显示“黑条”。阅读更多关于Corona documentation

下面是代码从我config.lua文件我用

config.lua 

--------------------------------------------- 

--calculate the aspect ratio of the device 
local aspectRatio = display.pixelHeight/display.pixelWidth 
application = { 
    content = { 
     width = aspectRatio >= 1.5 and 800 or math.floor(1200/aspectRatio), 
     height = aspectRatio <= 1.5 and 1200 or math.floor(800 * aspectRatio), 
     scale = "letterBox", 
     fps = 30, 

     imageSuffix = { 
     ["@2x"] = 1.3, 
     }, 
    }, 
} 
+0

非常感谢你,我会考虑这个! – EvilLemons