1Variables and Parameters1/28/20082Opening Discussion■Do you have any questions about the quiz?■Let's look at solutions to the interclass problem.■Minute Essay responsesHow can you make the camera view the scene from above?Timing between provided walk methods and moves. For this you have to play with the speed and distance of the move.3A Problem■Consider the following problem. I'd like to have the penguin walk up to the skeleton, say “hi”, then walk back to where he started?■How can we accomplish this? What challenge do we face given what we know?4Variables■You should be familiar with the concept of a variable from algebra. Programming variables are similar, but not quite the same.■A variable is a name that we create that is attached to a chunk of memory in the computer that stores a value.■Unlike a math variable, the value of a programming variable can change as we execute the program.5Method Variables■Also called local variables, we create these in the method in which we want to use them.■We use these to compute and store values.■We have to provide a name and a type. Alice has four variable types.NumberBooleanObjectOther■Let's do this for a calculated value.6User Input■One of the uses of variables is to store values input by the user.■The world has methods that will bring up dialog boxes that we can use to enter values into a program.■The world also has helpful math functions that you might need to use to calculate certain values.■Some of these functions work with “Strings”. String is just the name that computer scientists have given to normal text data.7Another Problem■Assume that I made it so that the mummy did the same thing to the penguin and the skeleton. Now assume I add three more characters and want the same thing to happen to them.■What challenge would we face in trying to make this happen? What do we need to be able to do to get around this?8Parameters■Parameters are basically variables that we pass into methods. These give us the power to not have to duplicate too much code.■You have used parameters in many of the methods that are built into Alice. They simply provide information to the method to help it do what we want.■Let's use parameters to help simplify the code in our mummy world so that we don't have unnecessary duplication.9Minute Essay■What do you think about the pace of the class so far? Do you feel that you can get comfortable with the skills/concepts we introduce each class?■Interclass Problem - Take the object you animated previously and give it a new method called walkToward that takes an object as an argument. This method should have your character turn to face the thing it needs to walk toward and then take a step toward
View Full Document