我想让一个精灵图像与硬币发生碰撞。硬币是一个图像,它总是因为这段代码而移动:
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
有谁知道我如何与硬币图像发生碰撞?
提前致谢。