Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

Thread Tools Display Modes
Junior Member
Status: Offline
Posts: 8
Join Date: Aug 2014
Default Lab4-TT - 11-27-2014, 12:13 AM

Lab 4 hurts the brain, but I made it. The only thing I left out was to keep track of the number of rings that are not caught.

At first, I could not figure out how to make each ring fall at the different speeds, but basic Physics prevails (distance = velocity * time). After that, figuring how to make all the rings fall at the same time was extremely tricky. I ended up using lots of "Do together" statements. I wish I could shorten the methods I wrote; I tried to refactor numerous times but the code keeps breaking... Then Alice starts acting up when I changed thing up (maybe a glitch in the system?) but I had to restart Alice many times, which is very frustrating.

5 world methods:
introToGame (prints out instructions for the game);
resetPosition (reset a torus's position to a random location after each round)
makeOneTorusFall (have a torus move up, move to a random location, set visibility to 100, fall down, set visibility to 0)
addThreeFallingToruses (make 3 toruses fall at the same time)
playGame (start out with 1 torus, then when one ring is caught, add 3 more toruses, when 3 rings is caught, add 3 more toruses and so on. A ghost will announce the number of rings caught so far during the game).

1 world function:
calculateCaught (increase the score by one when cone is within 0.2 meter of a ring)

2 world properties:
toruses (list of 10 toruses)
torusSpeeds (list of 10 speeds)

All in all, fun lab!
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.