Hi everyone,
I really didn't want help for this because I though it would be quite easy and it should but something's wrong somewhere and to me I dont see an error but there must be if it's not working... so yeah.
Basicly, in my object type code I made a rectangle with lines and so I wana be able to drag it around. It should be as easy as checking if the left mouse is down then checking last point of origin and comparing it with the current MouseX and MouseY location and then you move it accordigly.
here's the piece of code that should be doing this (notice the code to make it follow the cursor isnt made yet, I was testing for if it's right or left of the point of origin(lastx) then it moves left or right by 1 but it only goes right.)
mtest is drawn in my draw method for testing purpose aswell as mtest2.
Xpos and Ypos are the current top left position of the object.
I really didn't want help for this because I though it would be quite easy and it should but something's wrong somewhere and to me I dont see an error but there must be if it's not working... so yeah.
Basicly, in my object type code I made a rectangle with lines and so I wana be able to drag it around. It should be as easy as checking if the left mouse is down then checking last point of origin and comparing it with the current MouseX and MouseY location and then you move it accordigly.
here's the piece of code that should be doing this (notice the code to make it follow the cursor isnt made yet, I was testing for if it's right or left of the point of origin(lastx) then it moves left or right by 1 but it only goes right.)
Local mx:Int=MouseX() Local my:Int=MouseY() If(mx>Xpos)And(mx<Xpos+Width)And(my>Ypos)And(my<Ypos+Height)Then ' DRAG WINDOW Local lastx:Int Local lasty:Int ' Get First X&Y Loc If MouseHit(1)Then lastx=mx mtest2=mx End If ' On Dragging If MouseDown(1) mtest="true" If(lastx<mx)Then Xpos:+1 EndIf If(lastx>mx)Then Xpos:-1 EndIf Else mtest="false" End If EndIf
mtest is drawn in my draw method for testing purpose aswell as mtest2.
Xpos and Ypos are the current top left position of the object.