[Thread Prev] [Thread Next]
On 10 Feb 2007 at 20:39, zehava wizman wrote:
> Hi Alain!
> The instruction setseconds timer / 10 is within the forever loop and also
> the touching instruction is there, even so it doesn't work. WHY?
> Zehava
I had to reformat your procedure to be able to match the
brackets more easily:
to test
setseconds 0
t2, setpos [217 -8]
t1, setpos [-245 -4]
t2, clickon
forever [
t1, towards "t2
resett
t1, clickon
t2, clickon
setseconds timer / 10
if seconds = 100 [
question [You won Next stage? yes/no]
if answer = "yes [page2]
if answer = "no [stopall]
if touching? "t1 "t2 [
announce se timer / 10 "seconds
stopall
]
]
]
end
Then I saw that you are resetting the timer forever,
and you are clicking on the turtles forever.
I moved those instructions outside the forever:
to test
setseconds 0
t2, setpos [217 -8]
t1, setpos [-245 -4]
resett
t1, clickon
t2, clickon
forever [
t1, towards "t2
setseconds timer / 10
if seconds = 100 [
question [You won Next stage? yes/no]
if answer = "yes [page2]
if answer = "no [stopall]
if touching? "t1 "t2 [
announce se timer / 10 "seconds
stopall
]
]
]
end
This part is also suspicious:
...
if answer = "yes [page2]
if answer = "no [stopall]
if touching? "t1 "t2 [
announce se timer / 10 "seconds
stopall
]
...
there are two possible outcomes here:
1. the answer is yes and we go to page2, do you still want to check collitions
afterwards?
2. the answer is no and everything stops, in that case the program never
reaches "if touching".
Daniel
OpenWorld Learning
Previous by thread:
Re: problems with timer-towards-touching
Next by thread:
Re: problems with timer-towards-touching
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.
|