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
sheep herder game Cant grab sheep.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: sheep herder game Cant grab sheep.
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
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
-
- Posts: 8
- Joined: Fri Mar 28, 2014 2:47 pm
Re: sheep herder game Cant grab sheep.
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
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
Re: sheep herder game Cant grab sheep.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!