(Corona SDK)绘图区域

时间:2012-10-15 18:50:36

标签: lua touch corona draw area

我需要一些帮助......好吧,我在游戏中创造了一个很长的关卡。我的等级分辨率是1280 x 960(高度x 2),问题是当相机跟随物体时,我只能在640 x 960区域绘制线条,即使我绘制它,我的线条也会在640 x 960区域上绘制某处1100高度区......我无法弄明白......线和相机都来自电晕文件而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)



--Camera follows bolder automatically
local function moveCamera()
  if (obj.x > 320 and obj.x < 960) then
    gameGroup.x = -obj.x + 320
  end
end


Runtime:addEventListener( "enterFrame", moveCamera )

1 个答案:

答案 0 :(得分:1)

致电时

fileTwo:stop();

您正在调用transition.cancel( null ),并且似乎使用null调用此函数会导致奇怪的行为。

如果你把它放在fileTwo

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

问题已经消失。