[Thread Prev] [Thread Next]
Hello,
Try these:
ifelse (abs (150 - xcor)) < 0.25 [pr [yes]] [pr [no]]
ifelse (and
(abs (150 - xcor)) < 0.25
(abs (200 - ycor)) < 0.25
heading = 0)
[pr [yes]] [pr [no]]
Also, explore "distance"
if distance "t2 > 10 [pr "yes]
-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
askanexpert@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sent: Tuesday, November 20, 2007 5:35 AM
To: askanexpert@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: MIA, Ask an Expert: abs xcor ycor and heading
This is an automatic message sent from the web form at:
http://mia.openworldlearning.org/mwforum.htm
from: David Burke <burkd1@xxxxxxxxx>
date: Tue Nov 20 03:35:08 2007
platform: Mac OS10
version: MicroWorlds Ex
I have a game where my students have to navigate a polygon
maze to win. I want to check if there turtle is within a
specified distance of the target. I want their xcor, ycor
and heading to be within 0.25, or any other chosen
precision. I was trying to get the ABS command to work for
this with no luck. Here is what I was trying:
ifelse abs 150 - xcor < 0.25 [pr [yes]] [pr [no]]
and more detailed:
ifelse and abs 150 - xcor < 0.25 abs 200 - ycor < 0.25 heading = 0 [pr
[yes]] [pr [no]]
I use both PC and Mac
Previous by thread:
MIA, Ask an Expert: abs xcor ycor and heading
Next by thread:
RE: MIA, Ask an Expert: abs xcor ycor and heading
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.
|