Skip to content

1998code/Pong-Wars-SwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pong Wars (SwiftUI Edition)

Pong Wars is a creative take on the classic Pong game, where two balls bounce around the screen, each "painting" the canvas with its own color. The visual result is a mesmerizing battle between two colors that constantly shifts as the balls move across the screen.

cover

Features

  • Runs natively on Apple platforms with SwiftUI
  • Interactive controls for grid size and game speed
  • Custom color picker for both balls and background colors
  • Fullscreen mode with a clean, minimal UI
  • Live score tracking
  • Smooth animations with proper collision physics
  • Adaptive layout for different device sizes

How It Works

The game consists of:

  • Two bouncing balls with different colors
  • Each ball converts tiles to its own color when it passes over them
  • Physics-based collision detection with the edges
  • Customizable grid density and game speed
  • A simple yet captivating visual aesthetic

Implementation Details

The game is built using:

  • SwiftUI for the user interface
  • Canvas API for efficient rendering
  • Swift's native timers for game loop
  • The Model-View-ViewModel (MVVM) architecture
  • Custom color extensions for hex color support
  • Game physics with proper collision detection

Installation

  1. Clone the repository
  2. Open the project in Xcode
  3. Build and run on your preferred simulator or device

Credits

Inspired by the original Pong Wars by vnglst.

Alternate Versions

This SwiftUI implementation joins the growing list of Pong Wars versions created by developers around the world. Below are links to the original and other implementations:

About

About 2 balls battle. Made with SwiftUI.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages