【问题标题】:(Corona SDK) Area of draw(Corona SDK) 绘制区域
【发布时间】:2012-10-15 18:50:35
【问题描述】:

我需要一些帮助...好吧,我正在我的游戏中创建一个长关卡。我的水平分辨率是 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 )

【问题讨论】:

    标签: lua touch coronasdk draw area


    【解决方案1】:

    当你打电话时

    fileTwo:stop();
    

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

    如果你把它放在 fileTwo 上

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

    问题消失了。

    【讨论】:

      猜你喜欢
      • 2014-02-20
      • 2014-06-05
      • 2021-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-23
      • 2014-10-18
      相关资源
      最近更新 更多