Tino Intro To Java

Last modified: March 28, 2023

Lode Runner HW 3 Create Bars and Levels

In this lab, you will add bars to your Lode Runner world. Bars are like horizontal ladders.

You will also modularize your world into a level so that later on, you can create more levels for your game.

You can download a demo of this lab here.

Create bars

Start with the level you had from HW 2.

Create a Bar class; give it the appropriate image and size.

Then, in MyWorld, add some code that draws rows of bars. The bars should be at the top edge of a grid position, where the grid is the height of a ladder and the width of a wall.

Player movement on bars

Add code in your player class that makes your player go across bars with the left and right arrow keys.

The player should:

  • be placed so that their hands are on the bar.
  • show an animation when moving along the bar.
  • fall off the bar when the down button is pressed.
  • fall off the bar if it is moved too far just like walking off the edge of a platform.
  • never go into walls.

Hints:

Making the player snap to the bar when touching the bar is fairly simple, but also this doesn't look as good as if the top of the player has to touch the bar.

You can improve it by checking where the bar is located in relation to the player to confirm it is near the top of the player before snapping in place. Give it a bit of wiggle room for best effect.

Making MyWorld into a Level

Create a level made of platforms, ladders and bars. It should use helper methods and loops to lay out platforms, ladders and bars.

Use a grid with width equal to wall width and height equal to ladder height.

All the ladders and walls should be located at the center of grid positions.

All bars should be located at the top of grid positions.

The player should be able to travel all over the map.

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