alice-teacher Looking To Restrict Character Within Coordinate Boundaries in Alice 3

Vanderhyde, James vanderhyde at sxu.edu
Mon Mar 1 12:49:16 EST 2021


Bill,

How I like to do this is to put up an object (made transparent if you want) that works like a fence. You need one for each side of the region you’re trying to contain. So for a rectangle, you need four fences. Make sure they are all facing outward from the region.

Then, whenever you were going to move the object, use an if block to make sure it is “behind” the fence, using the isBehind built-in function. Only move the object if it is behind the fence.

James
—
James Vanderhyde
Associate Professor and Department Chair
Computer Science
Saint Xavier University
3700 W. 103rd St.
Chicago, IL 60655
773-298-3454

On Feb 28, 2021, at 10:06 PM, Barnum, William via alice-teachers <alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>> wrote:

Hey everyone,

I'm looking to restrict a character to within some coordinate boundaries within an Alice 3 program.

Since there isn't a way to pull coordinate data from an object while running the program, I'm trying to find a workaround, but everything I've come up with feels like a kludge.

Does anyone have any reasonably elegant way to do this?

Thanks,
Bill
_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>
To change settings or unsubscribe visit:
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20210301/2d948a68/attachment.html>


More information about the alice-teachers mailing list