Skip to content

Instantly share code, notes, and snippets.

@ldd
ldd / compositor
Created June 6, 2015 00:56
lighting (WEBGL + melonJS)
/* jshint plusplus:false */
/* jshint quotmark:false */
game.compositor = (function(){
var VERTEX_SIZE = 2;
var COLOR_SIZE = 4;
var TEXTURE_SIZE = 1;
var REGION_SIZE = 2;
var ELEMENT_SIZE = VERTEX_SIZE + COLOR_SIZE + TEXTURE_SIZE + REGION_SIZE;
var ELEMENT_OFFSET = ELEMENT_SIZE * Float32Array.BYTES_PER_ELEMENT;
game.PlayerEntity = me.Entity.extend({
init: function(x, y, settings) {
// call the constructor
this._super(me.Entity, 'init', [x, y, settings]);
// disable gravity
this.body.gravity = 0;
// walking & jumping speed
this.body.setVelocity(2.5, 2.5);
var glbPlaceManager = null;
var glbTimerManager = null;
var glbBonusManager = null;
var glbCompleteGame = false;
var glbCompleteMessage = false;
var glbSoundEffects = true;
game.PlayScreen = me.ScreenObject.extend({
/**
* action to perform on state change
*/
@ldd
ldd / github.js
Created January 14, 2016 06:14
github API for javascript using webpack
/*!
* @overview Github.js
*
* @copyright (c) 2013 Michael Aufreiter, Development Seed
* Github.js is freely distributable.
*
* @license Licensed under BSD-3-Clause-Clear
*
* For all details and documentation:
* http://substance.io/michael/github
@ldd
ldd / github.js
Last active January 14, 2016 06:18
github API for javascript using webpack
/*!
* @overview Github.js
*
* @copyright (c) 2013 Michael Aufreiter, Development Seed
* Github.js is freely distributable.
*
* @license Licensed under BSD-3-Clause-Clear
*
* For all details and documentation:
* http://substance.io/michael/github
{
"universities":{
"mcgill":{
"key": "mcgill",
"title": "McGill University",
"courseCodes":{
"COMP424":{
"title": "COMP 424: AI",
"metadata": {
"textbooks":[

preparations

  • install imagemagick
  • download and unzip assets

step-by-step guide

STEP 1: Finding the dimensions of the image

@ldd
ldd / Slider.js
Created January 18, 2017 21:15
Vertical Slider for Slick UI (Phaser)
SlickUI.namespace('Element');
/**
* Create a Slider to control defined values
*
* @author Richard Snijders <richard@fizz.nl>
* @param x
* @param y
* @param size
* @param value
@ldd
ldd / tiledtip.md
Last active January 23, 2017 07:24
using TIled from a non-interactive command line

This took some time to find, but this link should clarify the problem.

At least in MAC OSX, you need to do the following:

  1. create a script in /usr/local/bin/ and call it Tiled.

  2. add the following to it

#!/bin/bash
 exec "#{target}" "$@"
/* jshint plusplus:false */
/* jshint quotmark:false */
compositor = (function(){
var VERTEX_SIZE = 2;
var COLOR_SIZE = 4;
var TEXTURE_SIZE = 1;
var REGION_SIZE = 2;
var ELEMENT_SIZE = VERTEX_SIZE + COLOR_SIZE + TEXTURE_SIZE + REGION_SIZE;
var ELEMENT_OFFSET = ELEMENT_SIZE * Float32Array.BYTES_PER_ELEMENT;