Giter VIP home page Giter VIP logo

raw_pong's Introduction

Raw Pong - python

Overview

As part of the small practice, I have prepared the Pong game.

I don't think I need to describe the history of the Pong game to anyone. The first 'computer' game, as simple as building a flail. I saw it for the first time about 34 years ago at my neighbors' house. Back then, I didn't fully understand what a game console or computer was. But I liked it! Back to the topic.

I didn't use the Pygame library. My version of Pong uses the tkinter library as a window source and the pillow library (PIL) to draw the game. The game is controlled with the keyboard using the Keyboard library. You can use the requirements.txt file to install dependencies.

My version of Pong will be used for further experiments with neural networks. But more on that later.

Game construction

The entire game constitutes one "Game" class. I didn't see the point in splitting the player, ball, etc. into separate classes... The Game class has several parameters, i.e. the x and y position of the ball, the y position of both players, and the game parameters. We have several methods in it to control players, controlling the position of the ball, checking for collisions, drawing the playing field with players and the ball, pausing the game. The game loop works as follows:

  • checking if the game is not paused,
  • player movements,
  • ball movement,
  • collision test,
  • drawing the field of game.

For more details please check the code.

Licensing

There is no licensing. Everyone can use it as they want.

raw_pong's People

Contributors

maciejczarnacki avatar

Stargazers

 avatar

Watchers

 avatar

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.