Thanks to Cory Talbott, Southwestern student and USD 465 Techie, for the amazing presentation on Atari and the history of Video Gaming. Great detail on the programming side too....
This lesson is for the 1B Class and anyone who was NOT in the 4B class on Thursday. If you are in the 4B class scroll down to the bottom of this post.
Today, we are going to go into more detail about Visual Basic Properties. Go through the following tutorials in order. As you finish each tutorial, work through the example yourself. Save it as yourlastname_PropTutorial1, yourlastname_PropTutorial2, etc...I will check for these files upon my return.
Properties: Tutorial 1
Properties: Tutorial 2
When you complete the Tutorials...Ask your teacher for the "Find the Treasure" Assignment and have fun! Hint. For this project, the property that you will change is BackColor...Use Intellisense.
Attention 4B Students...Start Here If you have completed the "Find the Treasure" assignment from last Thursday...move ahead. Otherwise, finish the "Treasure" assignment and/or go through the above tutorials if you missed last Thursday.
4B Assignment: You are going to work on understanding "properties" a little bit more. Complete the following assignment.
Flowers Challenge: In this assignment, you will create a form to show flowers. You will write the code to cause changes to the properties of the form. First save the following images to your local computer (where you can retrieve them again).
Using these images, paint a form that looks like the following (to do so watch the below tutorial on adding images to a form):
Tutorial:
Adding Images to Forms Tutorial
Once the form is "Painted", do the following:
1. Set the visible property of the 4 pictureboxes to False. 2. Set the Border style of the 4 pictureboxes to Fixed3D. 3. Set the SizeMode property of the 4 pictureboxes to AutoSize. 4. Set the Image property of each picturebox to the corresponding image in the download folder. 5. Go to the code page. Just above the code itself are two dropdown lists. From the left dropdown list, choose label1. 6. From the right dropdown list, Choose MouseHover. 7. In the Label1.Mousehover event, set the Visible property of PictureBox1 to True. Set the Visible property of the other three boxes to false. 8. Do the same for the other three Labels, making the corresponding changes in which Pictures are visible and which are not. 9. The end result is a program that only shows one picture at a time when the mouse is held over the description.
When your program works correctly. Save it as yourlastname_Flowers and save it to the x:\4B\Flowers folder. If Flowers does not exist, will someone please create it?
Event handlers respond to inputs (mouse, keyboard) or program changes such as execution of a method.
The following are Event Handlers available in Alice:
World Events: When the World Starts While the World Is Running
Keyboard Events: When a Key is Typed While a Key is Pressed Let the Arrow Keys Move an Object
Mouse Events: When the Mouse is Clicked on Something While the Mouse is Pressed on Something Let the Mouse Move the Camera Let the Mouse Orient the Camera Let the Mouse Move Objects
Condition Events: When a variable changes While something is true When something becomes true
A While Statement is based a Boolean (true/false) condition and repeatedly executes it's containing statements as long as the condition is true. An Infinite loop is a loop that never becomes false.
Assignment: Using the provided file crash.a2w; modify it so that when the trucks get to close to each other, the condition becomes false and the loop terminates. (Hint: Use a "proximity" function to specify that the front wheels of each truck are at least .5 meters away from each other.) Also, add the following actions.
1. Make a crash sound when they "appear" to collide. 2. Make the front right wheel of the Cement truck roll down the street after the collision.
The Loop Statement allows coders to control the number of loop executions.
Assignment:
Open studentspeedingcar.a2w; Modify the Speedingcar world so that it calculates the total distance the car travels during its trip to the rest stop. Print the result (in the play output) when the car comes to a stop.
Speeding Car II Modify SpeedingCar so that it displays the distance the car has traveled while it is moving. Continuously display the result on a 3D text object that stays visible in the upper portion of the disply window.
Horse Assignment: Create an Alice world in which a horse (or other animal of your choice) is relaxing in a field. Define 5 different basic actions for the horse (sway it's tail, dip it's head, whinny, etc.) Use a loop to constantly keep the horse active, randomly choosing the next action. Add pauses of random duration between actions as well.
Using If/Else & While statements are an integral part of programming and learning logic.
"Control statements allow us to control the flow of our program's logic. Control statements make decisions based on the result of a condition. The condition produces a Boolean (true or false) result, which determines which statements are executed next." (Lewis & Depasquale, 42)
Lab:
Using Intersection3.a2w, obtained from the x:\4B folder; make the following changes:
1. Modify the decision statement to ensure that: The Bike turns right 20% of the time. The Bike turns left 40% of the time. The Bike goes straight 40% of the time.
2. Ensure that there is a 60% chance that the bell will play when the biker turns left.
Read and work through the linked tutorial. Upon completion, save the class you created in the tutorial in the x:\ in either 1B or 4B respectively, and in a folder called Lesson 9 (Create this folder if it does not already exist). Name the class yourlastname_SpinningHare. Also save the program named Alice 0150b specified in the tutorial in the same folder with yourlastname_alice150b