The SPIRE Engine ALPHA
Elijah Cirioli
by Kyle Bezio
HTML
<canvas id="myCanvas" width="700" height="500" style="border:1px solid #000000;"></canvas>
JavaScript
//setup canvas
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
/******************************************
GLOBAL VARIABLES
******************************************/
//general variables
var playing = false; //is the game running
var tileSize = 64; //the side length of individual tiles
var framerate = 30; //how many frames per second should the game run at
//arrays
var enemies = []; //the array of bad guys
var map = []; //where current maps are stored
var tileSet = []; //the array of tile types
//movement variables
var gravity = 1.7; //the amount of gravity in the level. Only applicable in sideScroller
var moveStyle = "sideScroller"; //"rotationBased", "RPG", or "sideScroller"
/******************************************
IMAGES
******************************************/
//the background --optional--
var backgroundImage = ""; //the url of the pic
var bgImage = new Image(); //defining the name of the image
bgImage.src = backgroundImage; //setting the .src
//menu image
var menuImage = "https://s1.postimg.org/3owiweug0v/New_Piskel_3.png"; //the url of the pic
var mnImage = new Image(); //defining the name of the image
mnImage.src = menuImage; //setting the .src
//selection image
var selectionImage = "https://s1.postimg.org/8y5b2ff52n/New_Piskel_2.png"; //the url of the pic
var seImage = new Image(); //defining the name of the image
seImage.src = selectionImage; //setting the .src
//character image
var spriteSheet = "https://s1.postimg.org/9o3ntp5zwf/New_Piskel_4_2_1_1_5_2.png"; //the url of the pic
var ssImage = new Image(); //defining the name of the image
ssImage.src = spriteSheet; //setting the .src
//top down grass
var grassTopImage = "https://s26.postimg.org/huzdqvh5l/New_Piskel_2.png"; //the url of the pic
var gtImage = new Image(); //defining the name of the image
gtImage.src = grassTopImage; //setting the .src
//side view of grass
var grassSideImage =...