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