Giter Site home page Giter Site logo

idris-pong's Introduction

idris-pong

A browser Pong game, taking advantage of Idris's ability to compile to javascript.

Compiling

  • Install Idris. Either visit http://idris-lang.org for instructions or, if you already have a Haskell environment, use cabal install idris.
  • Run idris --codegen javascript Main.idr -o pong.js.

Controls

Click the widget to start a game. In game, the paddle follows your mouse. The ball's velocity is changed every time it hits a paddle: if it hits the center, its horizontal velocity increases; if it hits an edge, its vertical velocity is adjusted in that direction. These effects are mediated by some parameters (see below).

Press escape at any time to quit a game (or cancel Attract Mode) and return to the menu.

Parameters

These can be tweaked from the Main Menu and take effect when you start a new game. If you see a set of parameters you like in Attract Mode, you can just click to start a game directly from there.

  • AI Speed: controls how quickly the AI paddle tracks the ball. Anything less than 6 is pretty easy. 8 is my personal favorite; anything more than 10 is pretty hard.
  • Twist factor: the maximum change in vertical velocity from hitting a paddle. Before being added to the paddle's vertical velocity, this value is scaled proportionally to the ball's distance from the paddle's center -- to add a lot of twist, hit with the edge!
  • Paddle width and height control the relevant dimensions of both paddles. Unfortunately, the two paddles cannot be made different sizes.
  • Acceleration factor: the dual of twist factor. This controls the maximum horizontal velocity added to the ball from a paddle collision (reached when the ball collides directly with the center of the paddle).
  • Initial velocity X and Y factors: these scale the relevant components of the ball's velocity when the game starts. With a high X factor and a low Y factor, the ball will start out going almost straight across the screen. With a higher Y factor, the ball might make several top-to-bottom runs before crossing the screen even once.

idris-pong's People

Contributors

trillioneyes avatar aartamonau avatar

Watchers

 avatar James Cloos avatar  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.