Java Swing – ASSORTED APPLICATIONS
TOPIC 02 – TEXT-BASED ADVENTURE GAME IN GUI

 

 

LESSON NOTE

 

 

Lessons in this unit require that you study the code to fully understand how things work. While some explanations may be provided, they are more examples than true lessons.

 

DESCRIPTION

 

This lesson will show you how to create a Text-based Adventure game in a GUI.  You might consider this a Choose Your Own Adventure game.  Essentially, this is simply an application that displays simple images and text and allows the user a few choices of how to respond based on the situation.  It is a little similar to a slideshow.

 

CODE VERSIONS

 

You might want to try out Version 3 right away to see what this is all about.  But working your way from Version 1 to Version 2 and then to Version 3 will likely allow you to better understand how the code works.

 

Version 1 – Start screen and End screen only

Version 2 – Added a Game screen to Version 1

Version 3 – Added a Playable Game to Version 2

 

POSSIBLE ADDITIONS

 

  • Create your own story.  Find images and create new locations in the code.
  • Make locations more dynamic by adding more checks (You can pass only if you have “The Sword”.)  (It’s a cool sword ok!  Stop judging my ideas!)
  • Add an inventory screen.
  • Add a map screen that shows the world.
  • Add a combat screen that shows your character’s stats and your enemy’s stats and options to FIGHT, RUN, HIDE, DEFEND and so on…
  • Add another screen for other functionality (quests, stats, score, …)
  • Use a timer or many to pressure the user to work quickly to complete the story.
  • Figure out a way to have a bit of randomness in your story.
  • Add something to collect such as experience or money or jewels.
  • Add a minigame within your game.