Tino Intro To Java

Last modified: March 28, 2023

Lode Runner HW 8 Menu and Buttons

Creating the Menu

Create a subclass of World to represent the Main Menu that contains the following:

  • A Lode Runner title
    • You decide how you want to do this. Here are some ideas:
    • You can find a graphic online and create a subclass of Actor with that image
    • You can draw the image on the background
    • Create an Actor that makes an image that says the title using the Greenfoot Image API
  • Right click on the menu world you created to create a new instance of that world. Greenfoot will always start out by creating a new instance of the last world you explicitly created an instance of.
  • Create a subclass of Actor to represent the start button.
    • You can decide what image to use for your start button
    • Each frame, the start button should check if it was clicked on. Examine the Greenfoot class API to find a method that checks if an actor has been clicked on.
    • When the button is clicked, you should create an instance of the world that runs the game (what used to be your only world class) and set the world to that world. See the Greenfoot class API for a method that allows you to set the world to a different world.

Gold Challenges

The basic start button and title screen is functional, but very bland. What can you do to spice it up?

Can you make your title screen have more interesting artwork and even animations to make it look nicer?

Can you make the start button animate when it is pressed and released? Here are some options: - Increase scale when button is pressed and scale back down when button is released. - Make the button darker when pressed and lighten back up when released.

If you are doing a button animation, you should delay setting the world until about a second after pressing the button. Make sure the button doesn't keep responding to further clicks once it is already pressed.

Can you make the menu fade or do another transition before switching to the game world?

Submission

Zip your entire project folder and submit it below.

  • Name your project folder PX_LastName_FirstName_LodeRunner.
  • Right click on your project folder and Send To -> Compressed (zipped) folder. On a mac compressing is similar, using a right click, but has a slightly different option.
    • You should end up with a zip file named PX_LastName_FirstName_LodeRunner.zip. For example if you were in 3rd period and named Michael Wang, then you would name the file P3_Wang_Michael_LodeRunner.zip
  • Make sure your Google Doc has Editing permissions for "anyone with the link". This is for your teacher and TAs.
  • Paste the link to your Google Doc in the Submission Comments section on this submission form (which becomes visible after you enter a file to submit)

You must Sign In to submit to this assignment

Dark Mode

Outline