sheep herder game Cant grab sheep.

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

Post Reply
apprentice12
Posts: 8
Joined: Fri Mar 28, 2014 2:47 pm

sheep herder game Cant grab sheep.

Post by apprentice12 » Thu Apr 10, 2014 2:47 pm

Dear community.

I have been studying the lessons from the academy courses but i am getting stuck .

Here is the code that i got from the lessons. Can you tell me what is wrong ?

Local sImASheep


on mouseDown
if the cIsSheep of the target is true then
put true into sImASheep
end if
end mouseDown

on mouseMove
if sImASheep is true then
set the loc of the target to the mouseLoc
if intersect (the target, Graphic "pen", 255) and the cIsSheep of the target is true then
set the backgroundcolor of the graphic "pen" to "red"
else
set the backgroundcolor of the graphic "pen" to "blue"
end if
end if
end mouseMove

MichaelUK
Posts: 9
Joined: Sun Mar 02, 2014 1:45 pm

Re: sheep herder game Cant grab sheep.

Post by MichaelUK » Thu Apr 10, 2014 10:29 pm

This is what i have mine works fine i think it could be the intersect line is the problem you have it split across two lines
did you also declare slmAsheep as a local var at the beginning of the code?

on mouseDown
if the cIsSheep of the target is true then
put true into slmASheep
end if
end mouseDown

on mouseMove
if slmASheep is true then
set the loc of the target to the mouseLoc
if intersect(the target, Graphic "pen", 255) and the clsSheep of the target is true then set the backgroundcolor of the graphic "pen" to "red"
else
set the backgroundcolor of the graphic "pen" to "blue"
end if
end if
end mouseMove

hope this helps
Michael

apprentice12
Posts: 8
Joined: Fri Mar 28, 2014 2:47 pm

Re: sheep herder game Cant grab sheep.

Post by apprentice12 » Fri Apr 11, 2014 9:24 am

Hi Michael.

Thank you very much for your reply.


Unfortunately the problem remains and yes i have declared the local sImAsheep in the top.

Maybe there is a bug on the version that i am using.

Have you uploaded your stack somewhere so i can download it ?

Thanks

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: sheep herder game Cant grab sheep.

Post by Simon » Fri Apr 11, 2014 3:57 pm

http://revonline2.runrev.com/stack/528/ ... -device%29

Sorry on mobile. But there it is.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply