I am making a matchstick puzzle game which has several buttons with matchstick images that rotate and change image as they snap to a grid using "if intersect(me, grid line x) then set the loc of me to the loc of grid line x" and similar if's for changing image and dimensions of the buttons. What I need to do now is make it so "If intersect(selected matchstick, any other matchstick) then set the loc of me to the loc of me when grabbed". This is to prevent the matchsticks from stacking behind one another.
I tried using:
Code: Select all
local sPos
on mouseDown
get the loc of me
put the loc of me into sPos
Grab me
end mouseDown
on mouseUp
if intersect(button "Match U1", button "Match U2") then
set the loc of me to the loc of sPos
end if
But it returns "error in object expression", near "505,185". So I know it is returning a location when mouseDown'd but I don't know how to fix it.
I can provide more details if requested, thank you for your help
