Lab4-TT
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! |
All times are GMT -5. The time now is 01:45 PM. |
Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.