GithubHelp home page GithubHelp logo

pygame-examples's Introduction

pygame-examples

Simple examples of pygame. Just for fun.

The only dependency, for now, is pygame

pip install pygame

bouncing_balls.py

A simple example of a group of balls with random colors and speeds. They bounce on the limits of the screen. No collision detection is implemented (yet).

To run:

python bouncing_balls.py [number_of_balls]

Capture01

Parallax Examples

Parallax scrolling is a technique in computer graphics where background images move past the camera more slowly than foreground images, creating an illusion of depth in a 2D scene and adding to the sense of immersion in the virtual experience.[1] The technique grew out of the multiplane camera technique used in traditional animation since the 1930s. From wikipedia

parallax_city.py

This example programmatically creates a moving background with three layers.

To run:

python parallax_city.py

Capture02

parallax_beach.py

This example programmatically creates three layers of sea and three layers of sand. They follow an smooth sine curve.

I do not recommend drawing curves as a series of bars like this example, it is too slow to process. I have not figured out the best way to do it in pygame yet.

To run:

python parallax_beach.py

Capture03

waves.py

Similar to the waves in parallax_beach, but created in a more efficient way. Also introduces several other concepts like random inialization and random change of the color of each wave.

To run:

python waves.py

Capture04

pygame-examples's People

Contributors

enriqueav avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

jesseokeya

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.