hey all
I have created a few boxes on screen via a Type and I want to be able to select them with my mouse cursor and while my left mouse button is held down, be able to drag them to another location.
I have got this working to some extent by testing for a collision with my cursor image and my box image, and if True then setting the box X,Y to equal the cursor image X,Y until I release the mouse button. However if I move the mouse around at a reasonably quick pace, the mouse cursor breaks free from the box image and so the collision test fails.
After spending quite some time on this (real newbie here :op ) I have decided to ask for some help...Maybe there is a more elegant solution instead of using the image collision function?
I have tried avoiding the collision function call and just testing to see if...
mouseX() > imgBoX and (mouseX() < (imgBoX+imgSize)
mouseY() > imgBoY and (mouseY() < (imgBoY+imgSize)
but the result is much the same
then I tried to make sure the mouseX() and mouseY() never stray too far from the Box image centre by bringing them back a few pixels if the cursor image moves too far from the Box images centre.
I hope I am being clear.
Anyway, any help with this would be appreciated..cheers guys.
I have created a few boxes on screen via a Type and I want to be able to select them with my mouse cursor and while my left mouse button is held down, be able to drag them to another location.
I have got this working to some extent by testing for a collision with my cursor image and my box image, and if True then setting the box X,Y to equal the cursor image X,Y until I release the mouse button. However if I move the mouse around at a reasonably quick pace, the mouse cursor breaks free from the box image and so the collision test fails.
After spending quite some time on this (real newbie here :op ) I have decided to ask for some help...Maybe there is a more elegant solution instead of using the image collision function?
I have tried avoiding the collision function call and just testing to see if...
mouseX() > imgBoX and (mouseX() < (imgBoX+imgSize)
mouseY() > imgBoY and (mouseY() < (imgBoY+imgSize)
but the result is much the same
then I tried to make sure the mouseX() and mouseY() never stray too far from the Box image centre by bringing them back a few pixels if the cursor image moves too far from the Box images centre.
I hope I am being clear.
Anyway, any help with this would be appreciated..cheers guys.