alice-teacher Moving a hovercraft/drone
Don Slater
don at alice.org
Tue Jan 14 08:13:47 EST 2020
Carl,
You did not mention if you were using Alice 2 or Alice 3. I am assuming that you are using Alice 2.
I created a boolean property for the world, named it isActive, and set its value to false.
I created a world method called startPropellers
while isActive
do together
turn each propeller to the right one revolution in ½ second, abruptly
For the events
When S is pressed, set isActive to true (I am using A is a toggle switch on)
When A is pressed, set isActive to false
When U is pressed, if isActive, move up ½ meter in ½ second, abruptly. — the drone will not move up if isActive is false
When D is pressed, if isActive, move down ½ meter in ½ second, abruptly — the drone will not move down if isActive is false
When the variable isActive changes, do the startPropellers method
Let the arrow keys move the drone — These will turn the drone left and right, move the drone forward (up key) and backward (down key)
I have attached an html document of the code for printing, a copy of the working world, and a copy of the drone.a2c class if anyone does not have it in their gallery.
Let me know if you are using Alice 3, as the events will be different (and I would be curious as to what model the students were using.)
Please let me know if you have any questions.
All the best,
Don Slater
Alice Project
> On Jan 13, 2020, at 3:06 PM, Hautmann, Carl <HautmannC at calvertnet.k12.md.us> wrote:
>
> I have a few students working on a project where they are trying to move a drone. When they press a key, they are trying to spin a propeller. They have assigned it to one set of keys but are trying to move it to the arrow keys and it is not working. Is there a way to assign the action to an alphumeric set as well as the arrow keys?
>
> Carl J. Hautmann
> Director of Bands
> Northern Middle School
> 413-550-9230
>
> "I would teach children music, physics, and philosophy; but most importantly music, for the patterns in music and all the arts are the keys to learning"
> -Plato
>
>
> _______________________________________________
> 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 <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/20200114/43318e84/attachment-0005.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Drone.a2c
Type: application/octet-stream
Size: 631366 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20200114/43318e84/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20200114/43318e84/attachment-0006.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DroneFlight.a2w
Type: application/octet-stream
Size: 797755 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20200114/43318e84/attachment-0003.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20200114/43318e84/attachment-0007.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20200114/43318e84/attachment-0008.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20200114/43318e84/attachment-0009.html>
More information about the alice-teachers
mailing list