Skip to content

ProjectgamesOOP/Adventure_to_the_Fallen_Kingdom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adventure to the Fallen Kingdom

This is a mini project of a group of students on Object-Oriented Programming subjects at VNUHCM - International University

Table of content

  1. Background
  2. Motivation of project
  3. Game
  4. Design & Capabilities
  5. Challenging
  6. 4 principles of OOP
  7. UML Diagram
  8. FAQ
  9. Resources
  10. License

1.Background

a. Introduction.

This is the game we created for the first semester of Object-Oriented Programming at VNUHCM - International University (2022–2023). This is a timeless game that is based on the 2D Platform Pixel genre and is incredibly well-liked worldwide. Our editing style is classic, and the protagonist is a Knight who must track down and vanquish the monster. The Kinght faced numerous challenges throughout the route, including slaying demons and traps. We hope you'll find our game project enjoyable.

b. Team members and task allocation.

Number Name Student ID Task Contribute
1 Duong Khanh Trang ITDSIU21127 Entities, Collision, Utilz, UML 20
2 Nguyen Quang Sang ITDSIU21113 Background, Entities, Utilz, UML 20
3 Phan Manh Son ITDSIU21116 Objects, Levels, Maps, Utilz, UML 20
4 Van Phu Minh Sang ITDSIU21112 Game States, GUI, Utilz, UML 20
5 Tran Quynh Nhu ITDSIU21105 Inputs, Sound, Object, Utilz, UML 20

c. How to run the game

  1. Step 1: Clone this Repository from our GitHub.
git clone https://github.com/ProjectgamesOOP/ProjectgamesOOP.git
  1. Step 2: Open the project source code folder in VS Code or any other IDE that supports Java language and check the file status.
git status
  1. Step 3: Run the game and enjoy

2. Motivation to Reality

Our goal was to make a difficult 2D pixel game that would appeal to fans of the classics. Our intention is to test players' resolve and skill sets while instilling in them a sense of admirable accomplishments. With dynamic fighting, a comprehensive gameplay system, and a dark fantasy setting, the game mimics the challenge and sinister tone of the Dark Souls series. It's a hard game because every choice you make can impact the result. Just endurance, in the end, is worthy.

3. GAME

a. About the game.

b. Content.

In Adventure to the Fallen Kingdom, set off on an exciting journey with the goal of becoming a renowned knight. Discover three different levels featuring pixel graphics and calming classical music. Gamers have to battle horrifying creatures that seek to encroach on human territory. Assume the part of the selected knight and discover your inner talent and bravery to conquer obstacles and establish your value as a respectable knight. Classic platform games serve as the foundation for Adventure to the Fallen Kingdom.

Level 1

Level 2

Level 2

c. How to play the game.

Key Action
A Move Left
D Move Right
Space Jump
Left Click Mouse Attack
  • Use A, D, Space to move the knight.
  • Use Left Click Mouse to attack the enemies.
  • Watch your mana bar (yellow) below your health bar (red).
  • Crack up boxes to discover mana or healing pills.

4. Design & Capabilities

To manipulate the color of pixels, we make use of BufferedImage(a class in Java that belongs to the java.awt.image package), an object that emulates image files. Each pixel in the game is a tile, entity, or object; distinct elements are indicated by red, green, and blue channels. The Level class uses methods like loadLevelData, loadEntities, and loadObjects to load level data from BufferedImage. These techniques generate related game elements by analyzing the colors of pixels. We maximize the amount of time and effort spent on development by obtaining game resources—such as sounds, music, and images—from Google.

Keyboard-based character control, a slashing technique for attacking the map until it collides with tiles, a tutorial at the first level, difficult bosses at the end level, an energy system for jumping, and potion-based recharging are just a few of the exciting updates.

We managed different modes and transitions in our game by using the State pattern. We designed our code to be flexible, maintainable, and readable by making separate classes for each state and using a Gamestate class to assign tasks to the current state object. Additionally, the Single Responsibility style is followed by the Constants class, which neatly keeps all game constants in one place. By guaranteeing that every class has a distinct purpose, this design principle encourages code readability and maintainability. Furthermore, constants are arranged by their respective categories (e.g., Projectiles, UI) in the Constants class.

5. Challenging

We encountered difficulties when importing assets, managing the codebase with Git and Githup, resolving errors that were difficult to locate (particularly in the Enemies section), and adding novel features. Communication and involvement were difficult when working in pairs.

6. Related to the 4 principles of OOP

Encapsulation, Abstraction, Inheritance, and Polymorphism—the four core concepts of object-oriented programming (OOP)—have become well-understood to us via our curriculum. We meticulously used these guidelines in the design and production of our game project.

a. Encapsulation.

In our game project, we have used classes like Player, Game, Enemy (including 3 Enemies class respectively for 3 level game), ... etc to provide encapsulation. Certain methods and properties are encapsulated in each class and kept secret from other classes. The Enemy class, for instance, has methods like isPlayerInRange, ...etc and the attributes like walkSpeed, maxHealth, currentHealth, etc. To allow for safe access and modification, getters and setters are employed. This encourages control and structure in the handling of the game's components.

b. Abstraction.

By employing abstract classes and interfaces, we managed to identify shared characteristics between game components. The StateMethod interface ensured that different game states would function uniformly (e.g., Playing, Menu, and GameOption are examples of classes in the GameStates packages that implement the Statemethods interface). Abstract classes like Enemy and Entity, which encapsulated fundamental behavior common by all enemies, encouraged code reuse. Abstraction improved modularity and maintainability, facilitating more efficient feature sharing and easier development.

c. Inheritance.

By using Inheritance to build subclasses, we were able to establish a hierarchical relationship and reuse code. We overriding particular procedures to alter the actions of Enemies such as Carnivorous, Big Bloated, and Turtle. In a similar vein, we added subclasses from the GameObject class, such as Potion, ObjectContainer, and Spike, to expand the functionality of objects. We did the same thing with the PauseButton class in the UI packages, extending its capabilities with subclasses like the SoundButton, UrmButton, and VolumeButton. By encouraging modular programming and minimizing code duplication, inheritance streamlined development and maintenance. It improved flexibility and customization by making it easier to create specialized subclasses that expanded upon the methods and attributes of parent classes.

d. Polymorphism.

Polymorphism allows objects of different classes to be treated as objects of a common superclass. This is often achieved through method overriding, where subclasses provide a specific implementation of a method that is already defined in their superclass. In the project, the concept of polymorphism is utilized through method overriding in the subclasses of different enemy types (Carnivorous, Turtle, Big_Bloated). Specifically, the update() method is overridden in these subclasses to provide their specific update behavior.

7. UML Diagram

a. Audio Diagram.


b. Entities Diagram.


c. Game states Diagram.


d. Inputs Diagram.


e. Levels Diagram.


f. Main Diagram.


g. Objects Diagram.


h. GUI Diagram.


i. Utilz Diagram.

8. FAQ

If you have any question about this Game Project, plesase leave them here

9. Resources

Oracle Java Documentation , Inheritance in Java Tutorial, Polymorphism in Java Tutorial, Abstraction in Java Tutorial, Encapsulation in Java Tutorial, Java How to program, Pixel Spritesheet

8. License

License: MIT

About

2D game project of International University (IU) - VNUHCM) students

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages