hey guys, well im trying to figure out how to set drag to an image of a triangle. is my code correct for setting drag? it is not working out. any tips or help would be greatly appreciated. thanks in advance!!!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | local physics = require("physics") physics.start() physics.setGravity(0, 0) --delete setdrawmode when done with adding all the physics...... physics.setDrawMode("hybrid") module(..., package.seeall) local localGroup function new() localGroup = display.newGroup() print( "Level 1" ) local sky = display.newImage( "Turqouise Back.png", 0, 0 ) localGroup:insert(sky) local button = display.newImage( "Main Menu.png" ) local function buttont ( event ) media.playEventSound( "Robot Blip.caf" ) if event.phase == "ended" then director:changeScene("Menu","moveFromLeft") end end button:addEventListener("touch",buttont) button.x = 260 button.y = 34 localGroup:insert(button) local triangle = display.newImage( "triangle.png" ) object:setDrag myImage:setDrag{ drag=true, limitX=false, limitY=false, onPress=myPressFunction,onDrag=myDragFunction, onRelease=myReleaseFunction, bounds={ 10, 10, 200, 50 }) localGroup:insert(triangle) <code> |
look at sample code called "dragme" in the sample code folder under Interface.
C.
okay i got it already sorry. but thanks anyway!!!