Skip to content

Instantly share code, notes, and snippets.

View AleBles's full-sized avatar

Ale Bles AleBles

View GitHub Profile
@AleBles
AleBles / ScaleManager.js
Last active January 15, 2019 10:28
Phaser v3 temp (css) scale amanger
class ScaleManager {
constructor(canvas, isMobile) {
this.canvas = canvas;
this.mobile = isMobile;
window.addEventListener('resize', () => {
this.resize(this.canvas);
if (this.mobile) {
if (window.innerWidth < window.innerHeight) {
@AleBles
AleBles / gist:73dea441e1c926f8924cdcf42e45333f
Created March 16, 2017 09:21
Webpack config with OG plugins
const path = require('path');
const webpack = require('webpack');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
// Phaser webpack config
const phaserModule = path.join(__dirname, './node_modules/phaser/');
const phaser = path.join(phaserModule, 'build/custom/phaser-split.js');
const pixi = path.join(phaserModule, 'build/custom/pixi.js');
const p2 = path.join(phaserModule, 'build/custom/p2.js');
@AleBles
AleBles / Pipe.ts
Last active December 6, 2016 12:07
class Pipe extends Phaser.Sprite {
public giveScore: boolean = true;
constructor(game: Phaser.Game, x: number, y: number, key: string) {
super(game, x, y, key);
this.game.physics.enable(this, Phaser.Physics.ARCADE);
this.body.velocity.x = speed;
}
@AleBles
AleBles / CatManager.ts
Last active May 25, 2016 15:16
CatManager singleton
class Cat {
public age: number = 0;
}
class CatManager {
private static instance: CatManager;
private catPool: Cat[] = [];
constructor() {}
define(function (require) {
"use strict";
var Config = require('config'),
configHelper = require('helpers/config');
var hasCocoon = (typeof CocoonJS !== "undefined" && CocoonJS.nativeExtensionObjectAvailable !== false),
constants = {};
constants.ACH_REENACTMENT_WIN_21 = 'yourgoogleachievementidhere';