Follow this as before just use your dimensions instead of 10 and add additional if statements to narrow the area, what you had before was way off would suggest doing some simple programming tutorials before continuing www.codecademy.com is supposed to be an OK site:
[lua]local startDrag = function( event )
if event.target.mName ~= nil and event.target.mName == “triangle” then
if event.x < event.target.x + 10 and event.x > event.target.x - 10 then
if event.y < event.target.y + 10 and event.y > event.target.y - 10 then
PUT DRAG CODE HERE FOR ALL EVENT CASES (START MOVED CANCELED ENDED)
end
end
else
.
PUT DRAG CODE HERE FOR ALL EVENT CASES (START MOVED CANCELED ENDED) this allows you to only apply the drag restrictions to certain object names, you can expand this using elseif statements
.
end
.
.
.
end
triangle = movieclip.newAnim{ “assets/gfx/box1/triangle.png” }
triangle.mName = “triangle”
local myShape = { -125 / 2, -125 / 2, 125 / 2, -125 / 2, -125 / 2, 125 / 2 }
physics.addBody(shape, { density = 1, friction = 1, bounce = 0, shape = myShape })
triangle:addEventListener(“touch”, startDrag)[/lua] [import]uid: 19176 topic_id: 14117 reply_id: 61183[/import]