(Corona SDK) 绘制区域

我需要帮助...我正在创建游戏中的一个长级别。我的级别分辨率为1280 x 960(高度 x 2),问题是当相机跟随物体时,我只能在640 x 960区域上画线,即使我将其绘制在高度为1100的区域上...我无法解决它...线条和相机来自corona文档,moveCamera来自EggBreaker示例...谢谢!

W = display.contentWidth;
H = display.contentHeight;

local function createPlatform(event)
    if (event.phase == "began") then
        if(line) then
            line.parent:remove(line);
        end
        x = (event.x - (W/2 - 80));
        y = (event.y - (H/2));
        line = display.newLine(W/2 - 80, H/2, event.x, event.y)
        line.width = 5;
        physics.addBody(line, "static", {shape = {0, 0, x, y}});
        line.isBullet = true;
    end
    if (event.phase == "moved") then
        x = (event.x - (W/2 - 80));
        y = (event.y - (H/2));
        if (line) then
            line.parent:remove(line);
        end
        line = display.newLine(W/2 - 80, H/2, event.x, event.y)
        line.width = 5;
        physics.addBody(line, "static", {shape = {0, 0, x, y}});
        line.isBullet = true;
    end
    if (event.phase == "ended") then

    end
end

Runtime:addEventListener("touch", createPlatform)

--相机自动跟随粗体字
local function moveCamera()
    if (obj.x > 320 and obj.x < 960) then
        gameGroup.x = -obj.x + 320
    end
end

Runtime:addEventListener( "enterFrame", moveCamera )
点赞
用户1172363
用户1172363

当您调用

fileTwo:stop();

您实际上是在调用 transition.cancel( null ),然而使用 null 来调用这个函数会导致一些奇怪的行为。

如果您在 fileTwo 中加入以下代码:

if(self.AnimationTransition ~= nil) then
    transition.cancel( self.AnimationTransition )
end

问题就会被解决。

2014-05-15 22:20:38