Skip to content

Latest commit

ย 

History

History
121 lines (94 loc) ยท 4.48 KB

File metadata and controls

121 lines (94 loc) ยท 4.48 KB

๐ŸŽฎ JavaAnimation

This repository contains lab work for Object-Oriented Software Development using JavaFX.
Each lab builds upon the previous one, enhancing the JavaAnimation application with new features, improved design, and better software engineering practices.

๐Ÿ‘‰ Visit my lab work: JavaAnimation

๐Ÿ‘‰ Original base project: JavaAnimation


๐Ÿ“š Labs Overview

๐Ÿ”น Lab 3 โ€“ Application Enhancements

The JavaAnimation application was extended with new UI elements, configuration options, and improved gameplay controls.

Key Features Added:

  • Main Screen
  • Configuration Screen
    • Added interactive controls:
      • Checkbox: Enable Shadow.
      • Radio buttons: Red, Green, Blue.
      • Slider (5โ€“20) to adjust ball size dynamically (updates label).
  • Game Integration
    • All settings affect the game directly (color, shadow effect, size).
    • Arrow key controls updated:
      • โฌ… Left: decrease speed (X direction).
      • โžก Right: increase speed (X direction).
      • โฌ† Up: increase speed (Y direction).
      • โฌ‡ Down: decrease speed (Y direction).

๐Ÿ”น Lab 4 โ€“ Refactoring & UI Improvements

Focused on enhancing the UI design and improving software structure using SOLID principles.

Key Improvements:

  • UI Enhancements
    • Introduced styles.css for a more polished look.
  • Exit Confirmation
    • Added a dialog to confirm before quitting, triggered by the Exit button or window close.
  • Code Refactoring (SOLID Principles)
    • Extracted logic from Main.java into separate classes.
    • Introduced a Screen interface; each screen (MainScreen, GameScreen, ConfigureScreen) implements it.
    • Created a Frame interface to decouple Main from individual screen implementations.
    • Added a Game class under the model package to manage game data.
    • Added ScreenWithGame interface for screens that need access to game data.

๐Ÿ”น Lab 5 โ€“ UI Redesign & GRASP Principles

Improved layout and refactored using GRASP design principles.

Key Features:

  • Redesigned GameScreen layout with game area(board) at top, Back button at bottom.
  • Game area enclosed in a visible rectangle with balanced margins.
  • Applied GRASP principles:
    • Information Expert: Moved ball data and logic to Game.
    • Creator: Added GamePane to handle visualization.
    • Controller: Added GameController to handle input.

๐Ÿ”น Lab 6 โ€“ Sprite System

Introduced a flexible sprite system with Factory and Singleton patterns.

Key Features:

  • Created Sprite interface with getNode() and setXY().
  • Implemented StarSprite (visual star).
  • Added SpriteFactory (Singleton + Factory pattern) for sprite creation.
  • Updated GamePane to display 10 randomly positioned stars at game start.
  • Created UML diagram showing relationships between Sprite system components.
  • Improved ball movement responsiveness.

๐Ÿ”น Lab 7 โ€“ Entities & Frame-Rate Independent Movement

Shifted towards an entity-based architecture with time-based updates.

Key Features:

  • Added GameConfig (Singleton) to manage configuration.
  • Created GameEntity abstract class with Player and Food subclasses.
  • Used process() method for frame-rate independent movement.
  • Linked Sprites with Entities.
  • Updated SpriteFactory as a middle layer between Game and GamePane.
  • Added entity life cycles (eternal, limited, expired).
  • Introduced PlayerSprite and Food linked to StarSprite.
  • Food items with random lifespan (5โ€“15s), some stationary, some moving.

๐Ÿ”น Lab 8 โ€“ Gameplay Mechanics & Audio

Added generics to sprites, player life system, decorator pattern, and audio functions.

Key Features:

  • Updated Sprite interface with generics.
  • Player starts with 10s life; eating food adds +5s and shows flying โ€œ+1โ€.
  • Applied Decorator pattern for low-life display.
  • Game over when life reaches 0.
  • Added audio with Facade pattern:
    • Background music.
    • Sound effects for eating, dying, and spawning.

๐Ÿ› ๏ธ Technologies

  • Java
  • JavaFX
  • CSS (UI styling)
  • JUnit 5 (Testing)
  • Mockito (Mocking)

๐Ÿš€ How to Run

# Clone the repo
git clone https://github.com/ayakoneko/JavaAnimation2.git
cd JavaAnimation2

# Open in your IDE (e.g., IntelliJ or Eclipse) and run Main.java / mvn clean javafx:run