Pengu Scenario
Jumping Tutorial and Notes
+ Challenges!
Instructions: Use the starter file below and follow along with the videos! Note - There are a few challenges at the end that you need to complete as well!
pengu_start_.zip |
NOTICE: THERE IS A MISTAKE IN THE TUTORIALS!
Actor under = getOneObjectAtOffset(0, getHeight()/2, Ground.class);
should be...
Actor under = getOneObjectAtOffset(0, getImage().getHeight()/2, Ground.class);
This will return the height of the Pengu image to us!
See the notes to make sense of using getOneObjectAtOffset:
Notes - getOneObjectAtOffset
Actor under = getOneObjectAtOffset(0, getHeight()/2, Ground.class);
should be...
Actor under = getOneObjectAtOffset(0, getImage().getHeight()/2, Ground.class);
This will return the height of the Pengu image to us!
See the notes to make sense of using getOneObjectAtOffset:
Notes - getOneObjectAtOffset
Challenges
- Add ONE Balloon class, and using the images under "objects" in the Greenfoot image files, make 3 different coloured Balloon objects float upwards, removing themselves at the top of the screen. Add these 1% of the time, and randomly on the x-axis. You should have a default constructor in the Balloon class that sets the balloon to have a certain color (ie. picture) and is worth a certain amount of points.
- When Pengu touches...
- a blue Balloon, he gets 2 points
- a yellow Balloon, he gets 5 points
- a red Balloon, he gets -3 points
Note: You will have to create accessors in the Balloon class to do this - Display Pengu's points on the screen