我想讓一個精靈圖像與硬幣碰撞。 硬幣是一個形象,因爲這個代碼是永遠向前:Corona SDK Lua-與硬幣碰撞
local tPrevious = system.getTimer();
local function move(event)
local tDelta = event.time - tPrevious;
tPrevious = event.time;
local xOffset = (0.3 * tDelta);
grass.x = grass.x - xOffset;
grass2.x = grass2.x - xOffset;
coin.x = coin.x - xOffset;
if (grass.x + grass.contentWidth) < 0 then
grass:translate(480 * 2, 0);
end
if (grass2.x + grass2.contentWidth) < 0 then
grass2:translate(480 * 2, 0);
end
if (coin.x + coin.contentWidth) < 0 then
coin:translate(480 * 2, 0);
coinRect.x = coin.x
end
local i;
end
有誰知道我怎麼能有硬幣圖像的碰撞?
在此先感謝。
不知道我明白。你想檢測碰撞? –
是的,我想檢測碰撞 –