3
我有一個尺寸爲12 * 30的字符串的圖像。我想創建一個動畫,以便讓人感覺到拉伸一個字符串。我是通過縮放圖像來實現的,但是我面臨的問題是,縮放圖像沒有發生碰撞。它只出現在原始圖像大小的12 * 30區域。我希望碰撞發生在字符串的長度之外。有沒有更好的方法比縮放來做到這一點。謝謝。伸展一個物體
image_rect = display.newImage("string.png")
image_rect.x = frog_jump_SheetSet.x + 10
image_rect.y = frog_jump_SheetSet.y + 10
physics.addBody(image_rect)
image_rect.yScale = 0.1
localGroup:insert(image_rect)
image_rect .collision = onStretch
image_rect :addEventListener("collision",image_rect)
tr1 = tnt:newTransition(image_rect,{time = 50,yScale = string_length })
tr2 = tnt:newTransition(image_rect,{delay = 100,time = 50,yScale = 0.1})