0% found this document useful (0 votes)
208 views16 pages

2 10

The document provides instructions for a series of practice activities to create a complete animation project in Alice that incorporates various programming concepts learned throughout the course. These include defining a scenario and storyboard, programming object movement and interactions using variables, functions, control structures, and keyboard controls, testing and debugging the animation, and presenting the finished project.

Uploaded by

nadiaela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views16 pages

2 10

The document provides instructions for a series of practice activities to create a complete animation project in Alice that incorporates various programming concepts learned throughout the course. These include defining a scenario and storyboard, programming object movement and interactions using variables, functions, control structures, and keyboard controls, testing and debugging the animation, and presenting the finished project.

Uploaded by

nadiaela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Nadia Ela Sakinah

4617010059

TI 3A

Java Fundamentals
2-10: Variables
Practice Activities

Lesson Objectives:
• Understand variables and how they are used in programming

Try It/Solve It:


Open the "WhiteRabbitProject" project you saved in the previous lesson. You will use this
project for all of the practice activities listed below.

1. Declare a variable.
a. View the declared "bipedHop" procedure under the Biped class.
JAWAB :
b. Declare a variable in the bipedHop procedure named "hopHeight".
c. Give hopHeight a value type of DecimalNumber and initialize the variable to
.25.
JAWAB :

d. Save the project.

2. Add a variable to a procedure.


a. Add the variable hopHeight to the bipedHop procedure code so that the
bunny and White Rabbit hop up and down .25 meters when the bipedHop
procedure is called.
JAWAB :

b. Save the project.

3. Change an initialized value.


a. Change the initialized value for the hopHeight variable to .5 meters.
JAWAB :
b. Test the animation. The bunny and White Rabbit hop .5 meters up in the air
instead of .25 meters.
c. Save the project.

4. Randomize the value of a variable.


a. In the bipedHop procedure, change the value of hopHeight to a random
number between .25 and .75 meters.
JAWAB :
Klik drop down pada initialized value >> Random >>
NextRandomRealNumberinRange ??? , ??? >> 0.5 >> custom
DecimalNumber : 0.75
b. Test the animation. The rabbit and bunny should hop random heights
between .25 and .75 meters.
c. Save the project.

5. View the Java Code on the side


a. With the BipedHop procedure on screen click on the Window menu option,
then preferences and Java Code to enable the Java code on the side window.
JAWAB :
b. Identify the code that shows the boundaries of the random values in the java
code window (.25 and .75).
JAWAB :

c. In the Alice code change the first value from .25 to .45.
JAWAB :

d. Identify the code that shows this change in the java code window.
JAWAB :
e. Change the value back to .25.
JAWAB :

f. Close the Java window on the side window.


JAWAB :
g. Save the Project.

Java Fundamentals
2-11: Keyboard Controls
Practice Activities

Lesson Objectives:
• Use keyboard controls to manipulate an animation

Try It/Solve It:


Open the "WhiteRabbitProject" project you saved in the previous lesson. You will
use this project for all of the practice activities listed below.
1. Access event listeners.
a. View the event listeners available in the scene.
JAWAB :

2. Add and program a key press event listener.


a. Add a key press listener to the WhiteRabbitProject.
JAWAB :
b. Program the KeyPressListener procedure so that the baby bunny hops one
time when the "H" key is pressed on the keyboard. TIP: Use the bipedHop
procedure.
JAWAB :

c. Test the key press listener.


d. Save the project.
3. Program additional motions.
a. Add two or three more hedges in various places to the WhiteRabbitProject
scene to be used as obstacles for the bunny.
JAWAB :
b. Program an additional motion so that the bunny turns a quarter turn to
the right when the "R" keyboard key is pressed.
JAWAB :

c. Program another motion so that the bunny turns a quarter turn to the left
when the "L" keyboard key is pressed.
JAWAB :
d. Test the animation and use the keyboard keys to move the bunny around
the scene, avoiding the wall, white rabbit, and hedges.
e. Save the project.
4. Save your biped class so that you can use the hop procedure in other
animations.
a. Click on the classes list button and choose Biped and then biped again.
JAWAB :
b. Save the biped class to your MyClasses directory using the Save to class file
button
JAWAB :

c. Save the project.


5. Create a new animation from the starters tab on the new menu. Choose the
far East template and add the MarchHare into the left side of your scenario
facing to the right across the screen..
a. Using the classes list button and the biped class add your saved biped class
to your new project.
JAWAB :
b. Make the MarchHare hop across the screen six times.
JAWAB :

c. Save your project as EastMarchHare.


Java Fundamentals
2-12: Develop a Complete Animation
Practice Activities

Lesson Objectives:
• Use keyboard controls to manipulate an animation
• Use functional decomposition to write a scenario and storyboard
• Complete an animation
• Test an animation
• Reposition objects at runtime
• Plan the presentation of a completed animation project

Try It/Solve It:


1. Define a scenario for a complete animation.
a. Define a scenario for a rabbit and meadow scene animation that includes
all concepts learned in this course.
b. Plan to include all of the following features in your animation:
i. Complete scene of multiple objects from multiple classes, including
props and shapes
ii. Declared procedures
iii. Movement procedures
iv. Object rotation and object subpart rotation procedures
v. Simultaneous movement with the Do Together control statement
vi. Vehicle riding with the setVehicle procedure
JAWAB :
Vehicle box dengan text

vii. Functions
viii. IF and WHILE control statements
ix. Random numbers
x. Math expressions
xi. Variables
xii. Keyboard controls
2. Design a storyboard for a complete animation.
a. Create a storyboard for a rabbit and meadow scene animation that
includes all concepts learned in this course.
b. Use the scenario you created in the previous activity to help develop your
storyboard.
3. Program a complete animation.
a. Optional: Open the "WhiteRabbitProject" project file. You can start from
this project or start a new project from scratch.
b. Program a complete for a rabbit and meadow scene animation that
includes all concepts learned in this course.
c. Use the scenario and storyboard you created in the previous activity.
d. Review the checklist for animation completion below. Use this checklist to
ensure your animation is complete.
e. Save the project.
4. Test and debug a complete animation.
a. Test, edit, and debug the complete White Rabbit animation project.
b. Add programming comments to each section of code in the code editor.
c. Save the project.
5. Reposition objects at runtime.
a. Add the addDefaultModelManipulation procedure into the
initializeEventListeners code editor.
b. Test the animation, repositioning objects at runtime.
c. Save the project.
6. Upload your animation to YouTube.
a. Use the facility in the file menu to upload your animation to Youtube using
your Youtube account.
b. Save a copy of your animation as a local file on your machine.
7. Present a complete animation.
a. On your own or with your project group, plan, practice and deliver a
presentation of your complete Alice 3 animation. Show all aspects of your
animation and show how each concept learned in this course was used in
your complete Alice 3 animation project.

You might also like