function init() {
//initalize the game variable as a Game object VVVV
//call other game methods here for customization
}
//change to show or hide tile numbers
var displayTile = true;
//which tiles are walkable???
var walkableTiles = [0];
//size of tiles
var tileW = 64;
var tileH = 64;
//size of sprites
var playerW = 48; //less than tileW
var playerH = 48; //less than tileH
//speed of player
var spd = 8;
//bullet variables
var bulletSpeed = 10;
var bulletColor = "black";
//baddie homing distance
var baddieDistance = 10;
var winMessage = "Player is the winner!";
var loseMessage = "player is dead!";
//change to your images vvvv
var playerImage = "http://s27.postimg.cc/ny55wdhj7/level_game_sprite.png";
var baddieImage = "http://s28.postimg.cc/bsi7njvdp/level_sprite.png";
var tileSheet = dd;
var bgImage = "http://s28.postimg.cc/66hjuw9lp/mm_bg.png";
var splatImage = "http://s32.postimg.cc/3l9ir67up/splat.png";
var goalImage = "";
//images for guns
var shotgunImage = "https://cdn3-1.cdn.schoology.com/system/files/imagecache/lightbox_preview/attachments/files/m/201605/group/565915397/smith_and_wesson_shotgun_572d00c646f98.jpeg";
var pistolImage = "http://s32.postimg.cc/f4qafl4b5/pistol.png";
var swordImage = "https://s14.postimg.cc/vgzpyxvf5/sword.png";
// ammo, damage, rof, image
var gunsInGame = [];
shotgun = new Gun(7, 20, 1.5, shotgunImage);
//xTile, yTile, ammo, damage, rof, image
pistol = new Gun(16, 4, 10, pistolImage);
///////////////////////
sword = new Gun(0, 5, 1, swordImage);
//keys
//////////////////////
var left = 37; //left arrow
var right = 39; //right arrow
var up = 38; //up arrow
var down = 40; //down arrow
var fire = 32; //space
var reload = 82; //r
var drop = 69; //e
var cycle = 81; //q
/****************
change for your own maps
****************/
var map1...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.