Skip to content

Instantly share code, notes, and snippets.

View photonstorm's full-sized avatar

Richard Davey photonstorm

View GitHub Profile
@photonstorm
photonstorm / phaser-fx-typescript.ts
Created February 10, 2021 12:06
Phaser FX TypeScript Example
import Phaser from 'phaser';
import { DoomWipePostFX } from './DoomWipePostFX';
class Example extends Phaser.Scene
{
constructor ()
{
super('Example');
}
@photonstorm
photonstorm / shape.js
Created August 5, 2020 21:13
Add body to shape
var config = {
type: Phaser.AUTO,
parent: 'phaser-example',
backgroundColor: '#0072bc',
physics: {
default: 'arcade',
arcade: {
debug: true
}
},
@photonstorm
photonstorm / ImageFileLoader.js
Created August 1, 2020 17:23
Phaser 3 Image File Loader class
class ImageFileLoader extends Phaser.Events.EventEmitter
{
constructor (scene, allowMultipleFiles = true)
{
super();
this.scene = scene;
this.textures = scene.sys.textures;
@photonstorm
photonstorm / carfollow.js
Created June 24, 2020 09:31
Car follow path + boost
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#2d2d2d',
parent: 'phaser-example',
scene: {
preload: preload,
create: create,
update: update
class PointerMonitor
{
constructor (scene, pointer, swipeThreshold = 100, swipeDuration = 500)
{
// The current Scene
this.scene = scene;
// The Pointer we're monitoring for swipes
this.pointer = pointer;
@photonstorm
photonstorm / PlatformerAttempt1.js
Last active October 26, 2018 12:32 — forked from RabbidLnk/PlatformerAttempt1
Platformer Problem
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Basic Platofrmer Idea</title>
<script src="//cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser.js"></script>
<style type="text/css">
body {
margin: 0;
}
@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,
@photonstorm
photonstorm / chiptune2-iOS.js
Created November 8, 2017 03:13
iOS fixed version of chiptune2.js
// audio context
var ChiptuneAudioContext = window['AudioContext'] || window['webkitAudioContext'];
// config
var ChiptuneJsConfig = function (repeatCount, context)
{
this.repeatCount = repeatCount;
this.context = context;
}
@photonstorm
photonstorm / gameframeworkterms.txt
Last active March 19, 2021 23:42
A list of the terms that game frameworks use to describe a 'scene' or 'state', i.e. such as a composition of objects in a level
Cocos2D - Scenes (and nodes)
Godot Engine - Scenes (and nodes)
CryEngine - Level
Torque3D - World and Level
Starling - nothing that I could find! In their tutorial 'Game' extends 'Sprite' :)
Urho3D - Scene (and Objects)
Atomic Game Engine - Scene (and nodes)
Monkey Engine - AppStates (short for Application States)
Banshee Engine - Level
Superpowers - Scenes (State is used too, to define entities changing states, Actors = Sprites)
@photonstorm
photonstorm / game.js
Created May 10, 2017 00:44
Phaser Game Config Object
var conf = {
width: 800,
height: 600,
renderer: Phaser.AUTO,
parent: 'phaser-example',
transparent: false,
antialias: false,
state: this,
scaleMode: Phaser.ScaleManager.EXACT_FIT
};