CIS 3100 Introduction to Programming Using Virtual Reality

# However when you are working on your own worlds it is

• Notes
• 38

This preview shows page 29 - 31 out of 38 pages.

However, when you are working on your own worlds, it is best to save the world before playing it. 7. To change the amount the bunny moves, click the 1 meter parameter in the move tile in your new method, and then either choose one of the values in the drop-down menu that appears, or click other, and then enter a number on the calculator-style keypad that appears. Try changing the amount a few times and then playing the world after each change until you can make the bunny move approximately to the middle of the screen. 8. Let’s add a few more instructions. First, find the [bunny turn to face] method tile. It’s in the Details area about 11 or 12 tiles below the bunny move tile that you just used. You will probably need to scroll down to see it. The parameter for this tile will be the object you want the bunny to face. Drag the tile into the Editor area below the bunny move tile, and choose camera as the object you want the bunny to face. 9. Next you are going to add two tiles to make the bunny speak, and then save the method. First, find and drag the bunny say tile into the Editor area below your other two instructions. The NOTE: Information that you must give to a method whenever you use the method is called a method parameter. Direction and amount are two parameters for the move method. The concept of a parameter adds considerably to the power of object methods (and even small functions). For it allows us to write a method once using dummy values (parameter names) to represent actual parameter values. Then, we can reuse the method repeatedly, without a rewrite, giving it the same or different actual parameter values each time.

Subscribe to view the full document.

Alice – Chapter 1 DRAFT June 10, 2013 pg. 30 of 38 parameter for this method is the phrase you want the bunny to say. This parameter is a string parameter, which contains string of characters from the keyboard. When the parameter menu appears, click other , and then enter “ Hello, world !” in the Enter a string input box that appears. Why “Hello, world!”? One of the most useful and popular programming languages ever created was the C programming language developed at AT&T labs in the 1970’s. The “Hello, world!” program first appeared in a book for the C language by two AT&T software developers, Brian Kernighan and Dennis Ritchie. Dr. Kerninghan, who is now a professor at Princeton University, actually wrote the first “Hello World!” program for a tutorial on an earlier programming language, BCPL. Ever since then, it has been the custom for someone programming in a new language to write a version of the “Hello, World!” program as his or her first program. Congratulations, you’ve just done that in a new language. ~~~ Steps to Perform ~~~ Let’s add one more instruction before saving the program. To add additional methods and save your world: 1. After the say Hello, World! tile in your program, add another bunny say tile to make the bunny say “Hello Dr. Kerninghan!” 2. Now play your world again (several times if you’d like), and when you are finished, click the Stop button to return to the Alice Interface.
You've reached the end of this preview.
• Fall '11
• Parsons

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern