The SPIRE Engine

Elijah Cirioli

HTML

<canvas id="myCanvas" width="500" height="500" style="border:1px solid #000000;"></canvas>

JavaScript

//setup canvas
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");

/******************************************
							GLOBAL VARIABLES
******************************************/
var playing = true; //is the game running
var tileSize = 100; //the side length of individual tiles
var gravity = 1; //the amount of gravity in the level
var enemies = []; //the array of bad guys
var map = []; //where current maps are stored
var tileSet = []; //the array of tile types
var staticCamera = false; //should the camera stay still
var framerate = 30; //how many frames per second should the game run at


/******************************************
							     IMAGES
******************************************/
var backgroundImage = "https://s24.postimg.org/9l26me0id/new_Wall.png"; //the url of the pic
var bgImage = new Image(); //defining the name of the image
bgImage.src = backgroundImage; //setting the .src


/******************************************
							     SOUNDS
******************************************/
var exampleSound = new Audio(""); //an example sound file


/******************************************
							      MAPS
******************************************/
var map1 = [
[0,0,0,0,0,0],
[0,1,1,1,1,0],
[2,2,2,0,0,0],
[0,1,2,1,0,0],
[0,1,0,0,0,0],
[0,1,1,1,1,0],
[0,0,0,0,0,0]
];

map = map1;


/******************************************
							  CHARACTERS
******************************************/
var player = { //The player-character
  x: 250, //the starting x-position
  y: 250, //the starting y-position
  angle: 0, //the angle the player is looking in
  speed: 0, //the speed the play is moving
}


/******************************************
							  MAIN THREAD
******************************************/
function gameCycle() {
	if (playing === true) {
  	drawMap();
  } else {
  
  }
}


/******************************************
						  	SETUP TILES
******************************************/
function tile(symbol,...