Skip to content

Instantly share code, notes, and snippets.

@ada-lovecraft
ada-lovecraft / menu.js
Last active September 27, 2015 14:44
Phaser 2.0 Tutorial: Flappy Bird (Part 1) : Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-1/
/* Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-1/ */
'use strict';
function Menu() {}
Menu.prototype = {
preload: function() {
},
create: function() {
// add the background sprite
@crisu83
crisu83 / phaser.js
Created June 25, 2014 07:03
Wrapper module for running Phaser.js on Node.js.
// this is an ingenius hack that allows us to run Phaser without a browser
// ... and yes, it took some time to figure out how to do this
var Canvas = require('canvas')
, jsdom = require('jsdom')
, document = jsdom.jsdom(null)
, window = document.parentWindow
, Phaser;
// expose a few things to all the modules
@jnsdbr
jnsdbr / rotate.js
Created August 1, 2014 15:14
Rotating a sprite towards the mouse pointer in phaser.js
window.onload = function()
{
var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '', {
preload: preload,
create: create,
update: update
});
var dragging = false;
@eguneys
eguneys / gesture.js
Created August 31, 2014 11:37
A Gesture Manager for Phaser.
'use strict';
define(['phaser'], function(Phaser) {
function Gesture(game) {
this.game = game;
this.swipeDispatched = false;
this.holdDispatched = false;
this.isTouching = false;
@ada-lovecraft
ada-lovecraft / gist:cf5b9411064a5b09eb74
Last active August 29, 2015 14:06
the grossest thing i've written in a long time
/**
* Adds aliases to any Object so that they can be used more semantically in code
*
* @method Phaser.Utils#propertyAlias
* @param {propetyName} obj - The object to add an alias to
* @param {string} [propertyName] - the current property name to alias
* @param {string} [aliasName] - the alias
* @static
* @example
* Phaser.Utils.propertyAlias(Phaser.Point.prototype, 'x', 'width');