Skip to content

Instantly share code, notes, and snippets.

@ssube
ssube / README.md
Last active June 25, 2020 05:06
phaser-post
@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) {
@photonstorm
photonstorm / phaser3-example.html
Last active February 21, 2024 05:27
Phaser 3 Example
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser-arcade-physics.min.js"></script>
</head>
<body>
<script>
var config = {
type: Phaser.AUTO,
@OliverJAsh
OliverJAsh / foo.ts
Last active July 29, 2023 18:16
Records and dictionaries in TypeScript
/*
In JavaScript, objects can be used to serve various purposes.
To maximise our usage of the type system, we should assign different types to our objects depending
on the desired purpose.
In this blog post I will clarify two common purposes for objects known as records and dictionaries
(aka maps), and how they can both be used with regards to the type system.
@georgesboris
georgesboris / phaser-webpack.md
Last active June 22, 2017 16:09
Phaser simple webpack setup

Using Phaser with Webpack

Using phaser with ES6, npm modules and whatnot is actually quite simple.

First, install the needed dependencies.

npm install -S expose-loader phaser-ce
@pangiole
pangiole / REBASE.md
Last active June 17, 2018 16:36
Rebasing strategy

Feature branches

Here it is a practical recipe to make you prefer rebase merging (git rebase) over recursive merging (git merge) especially when it's time to integrate changes from others while working on a feature branch.

Following alias will come in handy:

git config --local alias.history 'log --oneline --decorate --graph'

Synchronize

@xem
xem / readme.md
Last active July 14, 2024 10:15
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@nicoptere
nicoptere / ScaleX
Created June 7, 2015 09:59
performs a scale2x and scale3x operation on a HTML canvas
/*
JavaScript port of the following algorithm : http://scale2x.sourceforge.net/algorithm.html
*/
var scaleX = ( function( exports )
{
function getPixel32( data, x,y,w )
@alefteris
alefteris / .eslintrc
Created May 9, 2015 17:01
ESLint default config in YAML format
---
parser: espree
env:
amd: false
browser: false
es6: false
jasmine: false
jquery: false
meteor: false
mocha: false
(function() {
"use strict";
global.AudioContext = global.AudioContext || global.webkitAudioContext;
global.OfflineAudioContext = global.OfflineAudioContext || global.webkitOfflineAudioContext;
if (typeof global.AudioContext !== "undefined") {
if (typeof global.AudioContext.prototype.createGain !== "function") {
global.AudioContext.prototype.createGain = global.AudioContext.prototype.createGainNode;
}