This code is just making sure the "sheep" button is on the card
In this case the sheep would be off the card on top
Code: Select all
if the top of button ("sheep"&x) < the top of this card then
set the top of button ("sheep"&x) to the left of this card
end if
In this case the sheep would be off the card on the left
Code: Select all
if the left of button ("sheep"&x) < the left of this card then
set the left of button ("sheep"&x) to the left of this card
end if
In this case the sheep would be off the card on the right
Code: Select all
if the right of button ("sheep"&x) > the right of this card then
set the right of button ("sheep"&x) to the right of this card
end if
In this case the sheep would be off the card on the bottom
Code: Select all
if the bottom of button ("sheep"&x) > the bottom of this card then
set the bottom of button ("sheep"&x) to the bottom of this card
Put another way, if the size of the card was 800x800, if the top (or left) is less than (<) then 0, it is off the card so it needs to be set to 0. If the bottom (or right) is greater than (>) 800, it is off the card so it needs to be set to 800.