GithubHelp home page GithubHelp logo

earn9 / playground Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rezoner/playground

0.0 0.0 0.0 20.84 MB

Playground.js is a framework for your javascript based games. It gives you out-of-box access to essentials like mouse, keyboard, sound and well designed architecture that you can expand to your needs.

License: MIT License

JavaScript 100.00%

playground's Introduction

Playground.js

Out-of-box access to essentials like mouse, keyboard, sound and well designed architecture that you can expand to your needs.

Need instant help? Join our official slack

Core feature

Playground lets you establish a new application and bind essential events in one shot.

var app = playground({

  width: 640,           /* force width */
  height: 480,          /* force height */
  scale: 2,             /* force scale */
  smoothing: false,     /* antialiasing */

  /* silently preload assets before main loader */

  preload: function() { },

  /* assets from preloader available, push some more for main loader */

  create: function() { },

  /* called when main loader has finished  - you want to setState here */

  ready: function() { },

  /* called after container/window has been resized */

  resize: function() { },

  /* called each frame to update logic */

  step: function(dt) { },

  /* called each frame to update rendering */

  render: function(dt) { },

  /* states related events (called only for application */

  createstate: function() { },
  enterstate: function() { },
  leavestate: function() { },

  /* keyboard events */

  keydown: function(data) { },
  keyup: function(data) { },

  /* pointer events (mouse + touch) */
  
  pointerdown: function(data) { },
  pointerup: function(data) { },
  pointermove: function(data) { },
  pointerwheel: function(data) { },

  /* mouse trap */
  
  mousedown: function(data) { },
  mouseup: function(data) { },
  mousemove: function(data) { },

  /* finger trap */

  touchstart: function(data) { },
  touchend: function(data) { },
  touchmove: function(data) { },

  /* gamepad events */

  gamepaddown: function(data) { },
  gamepadup: function(data) { },
  gamepadmove: function(data) { }

});

Loaders

create: function() {
  this.loadData("maps", "units");
  this.loadImages("soldier", "tank", "base");
  this.loadSounds("fire", "medikit", "music");
}

States

ready: function() {
  this.setState(Game);
}

Read more in documentation.

playground's People

Contributors

rezoner avatar tnick avatar yoannmoinet avatar niorad avatar rialgar avatar jackrugile avatar rybar avatar frondeus avatar mattahj 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.