Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua 拉伸对象_Lua_Coronasdk - Fatal编程技术网

Lua 拉伸对象

Lua 拉伸对象,lua,coronasdk,Lua,Coronasdk,我有一个12*30大小的字符串的图像。我想创建一个动画,让它给人一种字符串拉伸的感觉。我是通过缩放图像来实现的,但我面临的问题是,缩放后的图像不会发生碰撞。它只出现在原始图像大小为12*30的区域中。我希望碰撞发生在绳子的长度之外。有没有比缩放更好的方法来实现这一点。谢谢 image_rect = display.newImage("string.png") image_rect.x = frog_jump_SheetSet.x + 10 image_rect.y = frog_jump_She

我有一个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})

电晕物理引擎不支持直接缩放,您唯一可以做的就是向对象添加矩形或根据需要删除它们以适应新形状

通常,在使用物理时应避免使用图像的缩放或旋转,而应仅将物理API更改为旋转(使用转矩),并且对缩放没有任何操作