Skip to content

Latest commit

 

History

History
205 lines (139 loc) · 10.6 KB

README.md

File metadata and controls

205 lines (139 loc) · 10.6 KB

Batman - Rooftop Rumble

Take on the mantle of Batman!

Fight through the deadly ninjas of the League of Shadows and stop them from terrorizing the citizens of Gotham City! Play as Batman as he rushes to a rooftop to deliver some crime-fighting justice! Fight through the enemies using Batman's gadgets and martial arts expertise.

This is an action-packed 2D-platformer. The game will include a levelled map which will allow the player to traverse through different layers. The enemy ninjas spawn at different locations and try to attack Batman using melee attacks. The player will be able to punch away at enemies while being able to jump, drop, and glide to different surfaces. At the end of each game, the player will be shown their score and will be prompted to enter their name. This will be saved to a high score similar to an arcade game.

User Stories

  • As a user, I want to be able to add my score to the scoreboard at the end of the game.
  • As a user, I want to be able to traverse through different layers of the map.
  • As a user, I want to be able to damage enemies.
  • As a user, I want to be able to receive damage from enemies.
  • As a user, I want to be able to throw a Batarang at an enemy to cause damage.
  • As a user, I want to be able to save my previous game to file (if I so choose).
  • As a user, I want to be able to be able to load my previous game from file (if I so choose).

Instructions for Grader

  • You can generate the first required action related to adding Xs to a Y by completing the game, entering your name in the text field at the bottom of the Scoreboard panel, and then clicking the "Add Score" button. This will add your name and score to the displayed Scoreboard.
  • You can generate the second required action related to adding Xs to a Y by clicking the "Remove Score" button. This removes the score you just added to the Scoreboard. This can only be done after adding your score in the first required action.
  • You can locate my visual component by going to the Main class in the UI folder of my project. This will launch the GUI of my project.
  • You can save the state of my application by pressing 's' while playing the game. Then, a splash screen will appear prompting the user if they are sure they want to save the game (Yes/No options).
  • You can reload the state of my application by pressing 'l' while playing the game. Then, a splash screen will appear prompting the user if they are sure they want to load the game (Yes/No options).

Phase 4: Task 2 (Adding X to Y, Removing X from Y)

New player and respective score is added to the scoreboard. Related actions are in bold.

Wed Aug 09 21:07:02 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:07:03 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:07:03 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:07:03 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:07:07 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:07:07 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 5

Wed Aug 09 21:07:08 PDT 2023 A ninja has been defeated by being punched! The score has been raised by 10 points to 15

Wed Aug 09 21:07:08 PDT 2023 Batman has been hit and his health is reduced to 99

Wed Aug 09 21:07:09 PDT 2023 Batman has been hit and his health is reduced to 98

Wed Aug 09 21:07:09 PDT 2023 Batman has been hit and his health is reduced to 97

Wed Aug 09 21:07:09 PDT 2023 Batman has been hit and his health is reduced to 96

Wed Aug 09 21:07:09 PDT 2023 Batman has been hit and his health is reduced to 95

Wed Aug 09 21:07:12 PDT 2023 A ninja has been defeated by being punched! The score has been raised by 10 points to 25

Wed Aug 09 21:07:12 PDT 2023 Batman has been hit and his health is reduced to 94

Wed Aug 09 21:07:13 PDT 2023 A ninja has been defeated by being punched! The score has been raised by 10 points to 35

Wed Aug 09 21:07:14 PDT 2023 A ninja has been defeated by being punched! The score has been raised by 10 points to 45

Wed Aug 09 21:07:15 PDT 2023 Batman has been hit and his health is reduced to 93

Wed Aug 09 21:07:15 PDT 2023 Batman has been hit and his health is reduced to 92

Wed Aug 09 21:07:16 PDT 2023 A ninja has been defeated by being punched! The score has been raised by 10 points to 55

Wed Aug 09 21:07:16 PDT 2023 Batman has been hit and his health is reduced to 91

Wed Aug 09 21:07:16 PDT 2023 Batman has been hit and his health is reduced to 90

Wed Aug 09 21:07:18 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:07:18 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 60

Wed Aug 09 21:07:21 PDT 2023 A ninja has been defeated by being punched! The score has been raised by 10 points to 70

Wed Aug 09 21:07:44 PDT 2023 Player Aman added to Scoreboard with score 70

Wed Aug 09 21:07:48 PDT 2023 Player Aman with score 70 has been removed from Scoreboard

Wed Aug 09 21:07:49 PDT 2023 You win! All ninjas defeated!

Phase 4: Task 2 (Modifying X in Y)

Old player's score is updated in the scoreboard. Related actions are in bold.

Wed Aug 09 21:14:36 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:36 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:36 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:37 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:39 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:40 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:40 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 5

Wed Aug 09 21:14:40 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:40 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 10

Wed Aug 09 21:14:40 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:40 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 15

Wed Aug 09 21:14:41 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:41 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 20

Wed Aug 09 21:14:42 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:42 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:42 PDT 2023 A Batarang has been thrown!

Wed Aug 09 21:14:42 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 25

Wed Aug 09 21:14:42 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 30

Wed Aug 09 21:14:43 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 35

Wed Aug 09 21:14:43 PDT 2023 A ninja has been defeated using a Batarang! The score has been raised by 5 points to 40

Wed Aug 09 21:15:07 PDT 2023 Player Average CPSC 210 Student's score has been updated to 40

Wed Aug 09 21:15:21 PDT 2023 You win! All ninjas defeated!

Phase 4: Task 3

Looking at my UML diagram at the end of the term, I see that I did not utilize any interfaces or abstract classes. I noticed that there are instances where I could have avoided repetitive code and could have used a more elegant solution. For example, I have a "Roof" and "Ground" class that both function as a surface. I could have made an abstract class called "Surface" where I have basic implementation that "puts Batman on a surface." I could have then had both "Ground" and "Roof" extend "Surface" where the difference would be that Batman could not drop from the ground. I could have also made a regular class called “Ground” that was extended by “Roof” where “Roof” would override that Batman could drop from it. I could also have done the opposite where “Ground” overrides “Roof” and does not allow Batman to drop from it. Currently, I handle all my collisions in the “Game” class so I could have simply made a “Surface” class instead of both a “Ground” and “Roof” class. Then, I could have instantiated a “Surface” with the name “ground” that did not allow Batman to drop from it. I prefer the idea of making an abstract “Surface” class since then I could make other types of surfaces in the future like where Batman is slowed, gets damaged, or sinks.

I also see that I made JsonWriter and JsonReader along with JsonWriterScoreboard and JsonReaderScoreboard. These classes have almost the exact same functionality except JsonWriter and JsonReader help with the data persistence of saving and loading the game while JsonWriterScoreboard and JsonReaderScoreboard help with keeping a record of all the players with their respective scores. I could have made JsonWriterScoreboard and JsonReaderScoreboard extend JsonWriter and JsonReader respectively where JsonWriterScoreboard and JsonReaderScoreboard override a scoreboard being saved and loaded to and from a JSON file instead of a game. I could have also used an abstract class in this scenario where all 4 classes extended it. Since JsonWriter, JsonReader, JsonWriterScoreboard, and JsonReaderScoreboard all have the same behavior, I could have also used an interface where the 4 classes would implement it.

Instead of making a “Batman” class, I would have made an abstract “Character” class. This would allow me to create other character classes like “Robin” that would extend “Character” along with “Batman.” This would allow the user to select which character they want to play as during the game. Each character could also have different attacks, animations, and sprites. Similar to this idea, I would also have made an abstract “Projectiles” class so that based on the character the user selected, a certain long-range attack could be used. For example, with “Batman,” a Batarang from the “Batarang” class would have been thrown but with “RedHood,” the user could shoot a gun using a hypothetical “Gun” class.

I would also remove the “TerminalGame” class completely from my design. Though learning how to use semi-graphical user interfaces in a text-only environment was interesting, I wish I could have started the project using Swing since I had to redo my work for Phase 1 in Phase 3. Considering features I want to add (not required for this task), I would want to implement different levels with each one getting progressively more challenging with enemy ninjas spawning at random locations on the screen. Along with this, I would want to add boss battles with “Boss” being an abstract class. Different comic villains would then extend this class and would have unique attacks, animations, hitboxes, and so on. Due to the fast-paced nature of this course, I did not have the opportunity to explore making my game more appealing. In the future, I would definitely want to add background images, animations, and sound effects.