Skip to content
项目

关于

Playground.js 是一个用于开发 JavaScript 游戏的框架,内置鼠标、键盘和音效等基本功能,并采用易于按需扩展的架构。

游戏与模拟器

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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.

探索相关项目

加载中…