Skip to content

SimplyDilisha/Magnet-Particles-Object-Version-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 

Repository files navigation

Magnet-Particles-Object-Version-

An interactive Pygame visualization where particles behave like magnetic objects, dynamically attracting toward the mouse cursor in real time.

Magnet Particles Simulation ๐ŸŽฏ

Magnet Particles Simulation is an interactive visualization built using Python and Pygame, where hundreds of particles move dynamically toward the mouse cursor, creating a magnetic-field-like effect.
This project demonstrates basic physics concepts, vector math, and object-oriented programming in a visually engaging way.


โœจ Features

  • Interactive magnetic attraction using mouse movement
  • 300 lightweight particles rendered in real time
  • Smooth motion using distance-based force calculation
  • Object-Oriented Programming (OOP) approach
  • Clean and minimal visual design

๐Ÿ› ๏ธ Technologies Used

  • Python 3
  • Pygame
  • math and random modules

๐Ÿ’ป Requirements

Python 3

Pygame (pip install pygame)

Run the Project python magnet.py

๐Ÿ–ฑ๏ธ How It Works

Each particle calculates its distance from the mouse cursor.

A magnetic force inversely proportional to the distance is applied.

Particles move smoothly toward the cursor, creating a magnetic field effect.

The closer the particle is, the stronger the attraction.

๐Ÿ™Œ Acknowledgement

This project was created as a learning experiment to explore interactive graphics and particle simulations using Pygame.

About

An interactive Pygame visualization where particles behave like magnetic objects, dynamically attracting toward the mouse cursor in real time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages