This project contains two Java-based games: Freeze Monster and Space Invaders. Each game has its own logic and uses the Factory Method design pattern to create instances of objects [...]
BadnessBoxSprite.java: Container forBadSpriteobjects, allowing multiple bad sprites to be grouped.BadSprite.java: Abstract class representing a generic bad sprite with basic behaviors and properties.FreezeBeam.java: Implements a specific type ofBadSpritethat represents a freezing ray.Slime.java: Implements a specific type ofBadSpritethat represents slime.Woody.java: Extends thePlayerclass to represent the player character Woody.FreezeMonsterBoard.java: Manages the game logic of "Freeze Monster".Bomb.java: Implements a specific type ofBadSpritethat represents a bomb.BomberSprite.java: ExtendsBadnessBoxSpriteto represent a bomber sprite.Shot.java: Implements a specific type ofBadSpritethat represents a shot fired by the player.SpaceInvadersBoard.java: Manages the game logic of "Space Invaders".Player.java: Represents a generic player character.MainFrame.java: Configures the game's main window.Sprite.java: Base class for all sprites.Commons.java: Interface that defines constants used throughout the project.FreezeMonsterGame.java: Main class that initializes the "Freeze Monster" game.SpaceInvadersGame.java: Main class that initializes the "Space Invaders" game.AbstractBoard.java: Abstract class that defines the basic structure of a game board.
The Factory Method pattern is used to create instances of game objects without specifying the exact class of the object to be created, promoting flexibility and code reuse.
AbstractBoard: Defines abstract methodscreatePlayersandcreatePlayer.FreezeMonsterBoard: ImplementscreatePlayerto create an instance ofWoody.MainFrame: Defines the abstract methodcreateBoard.FreezeMonsterGame: ImplementscreateBoardto create an instance ofFreezeMonsterBoard.SpaceInvadersGame: ImplementscreateBoardto create an instance ofSpaceInvadersBoard.
In the Freeze Monster game, the player controls the character Woody to navigate the board, avoiding or interacting with various sprites such as freezing rays, slimes, and bombs.
- Clone the repository to your local machine.
- Open the project in IntelliJ IDEA.
- Make sure all dependencies are resolved.
- Run the
FreezeMonsterGameclass to start the Freeze Monster game.
- Arrow Keys: Move Woody up, down, left, or right.
In the Space Invaders game, the player controls a cannon to shoot at space invaders descending down the board.
- Clone the repository to your local machine.
- Open the project in IntelliJ IDEA.
- Make sure all dependencies are resolved.
- Run the
SpaceInvadersGameclass to start the Space Invaders game.
- Arrow Keys: Move the cannon left or right.
- Spacebar: Fires shots.
This project is licensed under the MIT License. See the LICENSE file for more details.