I have created shape and when you press once it gets bigger, and so on 5 times. But after it gets bigger the collision works only from a middle of shape.
here is my code
-- add shape touches her
local i = 1
local function shapePressed()
if i \> 5 then return end
transition.to(shape, {time=10, xScale = shape.xScale + 0.3, yScale = shape.yScale + 0.3 })
i = i+1
end
-- add collision to the shapes
local function onCollision (self , event)
if (event.phase == "began" ) then
end
end
-- add shape
shape = display.newImage("levels/shape.png", 45,45)
shape.x = 240
shape.y =140
shape.collison = onCollision
group:insert(shape)
-- event listeners
shape:addEventListener("tap", shapePressed)
shape:addEventListener("collision", shape)
ground:addEventListener("collision", ground)
--add physics bodys
physics.addBody(ground, "static",{density = 3.0 , friction = 0.5, bounce = 0.1 } )
physics.addBody(shape, {density = 3.0 , friction = 0.5, bounce = 0} )
Is something wrong here. Please help [import]uid: 11559 topic_id: 20036 reply_id: 320036[/import]
[import]uid: 52491 topic_id: 20036 reply_id: 78242[/import]