Giter Club home page Giter Club logo

pygame_examples's Introduction

Pylint License: MIT

Pygame examples

A repository for short pygame drafts, examples, tutorials and more!

Currently, this repository contains a draft lighting system, a particle system, a networked game, a hexogonal tile system, a cloth simulation and other cool pygame examples.

Gif of the particle effects Gif of the lighting system Gif of the hexagonal tile map Gif of a red light source Gif of an evolution simulation Gif of the cloth simulation

Getting started

To get a copy of this repository, simply open up git bash in an empty folder and use the command:

$ git clone https://github.com/rbaltrusch/pygame_examples

Dependencies can be installed using the requirements.txt as below:

pip install -r requirements.txt

To run some of the examples, navigate to the respective folder in the code folder, then run main.py.

Contents

This repository contains the following small pygame examples:

  • Particle system: contains a simple, but effective, particle system implementation.
  • Evolution simulation: contains a simple simulation of evolving animals hunting for food.
  • Cloth simulation: contains a cloth simulation with custom physics.
  • Conway's game of life: contains a simulation of Conway's game of life.
  • Game console: contains a minimal implementation of an in-game console.
  • Animation testing tool: can be used to test out animations. Contains a fully featured in-game console with a decoupled and flexible design.
  • Networked game: contains a minimal implementation of a networked game, featuring one external server and two separate clients, communicating with each other through the server.
  • Dynamic lighting: contains a small draft implementation for dynamic in-game lighting.
  • Hexagonal grid: contains an implementation of a hexagonal grid, including collision handling.
  • Tidy event queue: contains an exercise in decoupling complex pygame event handling constructs into separate parts.
  • Async events: contains an example implementation for an asynchronous event handler (useful for writing linear-looking code for events with execution spread out over multiple game cycles).
  • Squish and stretch: contains an example implementation of squishing and stretching an image.
  • Timed events: contains an implementation of callbacks executed after a specified delay. Not pygame-specific.
  • Random starry sky: generates a random starry sky.

Contributions

To contribute to this repository, please read the contribution guidelines.

Python

Written in Python 3.8.3.

License

This repository is open-source software available under the MIT license.

Contact

Please raise an issue for code changes. To reach out, please send an email to [email protected].

pygame_examples's People

Contributors

dependabot[bot] avatar rbaltrusch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pygame_examples's Issues

Wrong center calculation

In hexagon.py file center is being calculated in wrong manner as x position also needs adjustment below is corrected code

@Property
def centre(self) -> Tuple[float, float]:
"""Centre of the hexagon"""
x, y = self.position # pylint: disable=invalid-name
return (x + self.radius / 2 , y + self.minimal_radius)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.