Sheep Herder

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

44www
Posts: 11
Joined: Sun May 11, 2014 11:39 am

Re: Sheep Herder

Post by 44www » Mon May 12, 2014 6:52 pm

Thank you , it helps me understand the layout of a stack.

What I don't understandt is why does it matter < or >.

You tell te program to check if the right of button ("sheep"&x) < or > then the right of this card but you put the then comand and say set the right of button ("sheep"&x) to the right of this card .

When I read this command I understand that you say to check if the right of button is < or > of the card but set the right of button to the right of the card anyway....

I hope you understand my dilema..... :oops:


I am a total noob in programing but live code seames easy to learn. :D

robertem
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 25
Joined: Tue Mar 19, 2013 2:58 pm

Re: Sheep Herder

Post by robertem » Mon May 12, 2014 7:15 pm

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.

44www
Posts: 11
Joined: Sun May 11, 2014 11:39 am

Re: Sheep Herder

Post by 44www » Tue May 13, 2014 8:14 pm

Hello

This helps me alot. Thank you

Post Reply