Lab5 Assignment

advertisement
Lab5 Assignment
Task1:Complete the following programming projects.
1. Read, run and understand the program sample MovingPicture.rap, then
modify this program.
 Load and display another picture;
Hints: put your picture and your raptor file in the same directory, when
you load this picture, the file path is not necessary and only the file
name is required. For example, if your file name is MyQQ.jpg, to load
this picture, the drawing command is
 Use w key to control the up movement, s key to control the down
movement, a key to control the left-movement; d key to control the
right movement;
 You can do the other modifications;
 Name your program 5.1.rap
2. Design your buttons
 Try to use the program sample MouseInput_ButtonDesign.rap
 Modify this program and design your own buttons with different color
and different shape. Design the corresponding event, when you press
your buttons.
For example, you can design two buttons, named weekday and
weekend. When the user presses the weekday button, show a crying
face picture in the graphic window, otherwise show a smiling face.
 Name your program 5.2.rap
3. Read and run the program file KeyHit_RandomWalking.rap. Try to
understand the random function. Then use random function to implement
some interesting things. Name your program 5.3.rap.
For example, randomly select a girlfriend/boyfriend. You can download
some pictures, and give each picture a number. Use random function to
generate a number, and then show the corresponding picture and the text
“This is your girlfriend/boyfriend”.
4. When you design your own button, Instead of drawing a button shape, you
can load a picture as the button. The stone_scissor_paper game is an
example. Play and understand it. Then re-design MovingPicture.rap
program, instead of using keyboard keys, design four buttons to control the
moving and use pictures as the button shape. Name your program 5.4.rap
5. If you have time, run and try to understand these interesting samples in the
directory lab5.
Prepare for your final project:
You have two weeks to consider your final project topic. It can be anything
you are interested in, or an old topic which is not perfectly completed by last
batch. You should tell our TA your final project topic before week 12.
Notice: please finish the first two labs before 10th Nov., we will score them in
week 11.
Assignment submission:
You should submit all raptor files into the Directory Lab5 into your network
drive. http://192.168.0.248/inbox/
Download