This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/// <summary> | |
/// A set of easy-to-implement animation functions. Compiled by Nick Pattison. | |
/// </summary> | |
public static class AnimMath { | |
/// <summary> | |
/// A function for lerping between 2 values. Yes, Unity has this Mathf.Lerp() and Vector3.Lerp(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Sprite(url){ | |
this.img = new Image(); | |
this.img.src = url; | |
this.img.addEventListener("load", ()=>{ | |
this.anchor.x = this.img.width/2; | |
this.anchor.y = this.img.height/2; | |
}); | |
this.x = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const canvas = document.getElementById("myCanvas"); | |
const gfx = canvas.getContext("2d"); | |
const keycode = { | |
w: 87, | |
a: 65, | |
s: 83, | |
d: 68, | |
left: 37, | |
up:38, |