Skip to content

Instantly share code, notes, and snippets.

View photonstorm's full-sized avatar

Richard Davey photonstorm

View GitHub Profile
@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 / stopSidewaysVelocity.js
Created February 24, 2016 11:39 — forked from ShimShamSam/stopSidewaysVelocity.js
Phaser Physics - Stop sideways velocity
/**
* Negate sideways velocity on an object being acted upon by a Phaser physics engine.
* The primary use for this is to simulate vehicle movement by negating "drift" when the vehicle turns.
* @param {Phaser.Sprite} sprite The sprite whose sideways velocity you want to negate
*/
function stopSidewaysVelocity(sprite) {
// Recycle the same object to conserve memory
if(!stopSidewaysVelocity.sideways) {
stopSidewaysVelocity.sideways = {};
}