diff --git a/index.html b/index.html index a87dc69..f26540c 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ Main Sandbox - Game + Map Rules Questions Spawn diff --git a/map.html b/map.html index 950d855..10861d1 100644 --- a/map.html +++ b/map.html @@ -4,15 +4,15 @@ - Javascript game + Civilization Map - - + + @@ -21,12 +21,12 @@ Main Sandbox - Game + Map Rules Questions Spawn - + + diff --git a/questions.html b/questions.html index ee1e790..e754878 100644 --- a/questions.html +++ b/questions.html @@ -12,7 +12,7 @@ Main Sandbox - Game + Map Rules Questions Spawn diff --git a/resources/game/css/style.css b/resources/game/css/style.css new file mode 100644 index 0000000..d355124 --- /dev/null +++ b/resources/game/css/style.css @@ -0,0 +1,4 @@ +#biome_map{ + width: 100%; + height: auto; +} diff --git a/resources/questions/images/biome_map_full_10.png b/resources/game/images/biome_map_full_10.png similarity index 100% rename from resources/questions/images/biome_map_full_10.png rename to resources/game/images/biome_map_full_10.png diff --git a/resources/game/blue_tile.png b/resources/game/images/tiles/blue_tile.png similarity index 100% rename from resources/game/blue_tile.png rename to resources/game/images/tiles/blue_tile.png diff --git a/resources/game/green_tile.png b/resources/game/images/tiles/green_tile.png similarity index 100% rename from resources/game/green_tile.png rename to resources/game/images/tiles/green_tile.png diff --git a/resources/game/purple_tile.png b/resources/game/images/tiles/purple_tile.png similarity index 100% rename from resources/game/purple_tile.png rename to resources/game/images/tiles/purple_tile.png diff --git a/resources/game/red_tile.png b/resources/game/images/tiles/red_tile.png similarity index 100% rename from resources/game/red_tile.png rename to resources/game/images/tiles/red_tile.png diff --git a/resources/game/white_tile.png b/resources/game/images/tiles/white_tile.png similarity index 100% rename from resources/game/white_tile.png rename to resources/game/images/tiles/white_tile.png diff --git a/resources/game/yellow_tile.png b/resources/game/images/tiles/yellow_tile.png similarity index 100% rename from resources/game/yellow_tile.png rename to resources/game/images/tiles/yellow_tile.png diff --git a/resources/game/tutorial.js b/resources/game/tutorial.js deleted file mode 100644 index 7119cbf..0000000 --- a/resources/game/tutorial.js +++ /dev/null @@ -1,82 +0,0 @@ -const World = function(canvas_id_tag){ - this.canvas = document.getElementById(canvas_id_tag); - this.context = this.canvas.getContext("2d"); - - this.clear = function(background_color="white"){ - this.context.beginPath(); - this.context.rect(0,0,640,480); - this.context.fillStyle = background_color; - this.context.fill(); - }; - - this.newSprite = function(filename, is_pattern=true){ - var mySprite = new Sprite(filename, this, is_pattern=true); - return mySprite; - }; -}; - -const Sprite = function(filename, world, is_pattern=true){ - switch(filename){ - case undefined: console.log("Unable to load Sprite: filename is undefined"); break; - case null: console.log("Unable to load Sprite: filename is null"); break; - case "": console.log("Unable to load sprite: filename is \"\""); break; - default: - break; - }//endswitch - - this.image = new Image(); - this.image.src = filename; - this.is_pattern = is_pattern; - const TO_RADIANS = Math.PI/180 - - if(is_pattern) - this.pattern = world.context.createPattern(this.image, "repeat") - - this.draw = function(x, y, w=this.image.width, h=this.image.height){ - world.context.drawImage(this.image, x, y, w, h); - } - - this.rotate = function(x, y, degrees){ - world.context.save(); - world.context.translate(x,y); - world.context.rotate(degees * TO_RADIANS); - world.context.drawImage( - this.image, - -(this.image.width/2), - -(this.image.height/2) - ); - world.context.restore(); - } - -}; - -var isReady = false; -var world; -var myCanvas; -$(document).ready(function(){ - //Initialize - world = new World("canvas"); - myCanvas = world.canvas; - world.clear(); - - const reddie = world.newSprite("./game/red_tile.png"); - reddie.image.onload = function(){ - reddie.draw(100, 100, 16, 16); - }; - isReady = true; -}); - -$('#canvas').on('mousedown', function(e){ - const pos = getMousePos(canvas, e); - mx = pos.x; - my = pos.y - console.log(mx, my); - reddie.draw(mx % 16, my % 16, 16, 16); -}); -function getMousePos(canvas, evt) { - var rect = canvas.getBoundingClientRect(); - return { - x: evt.clientX - rect.left, - y: evt.clientY - rect.top - }; -} diff --git a/rules.html b/rules.html index 2f3f87f..bb5905c 100644 --- a/rules.html +++ b/rules.html @@ -9,7 +9,7 @@ Main Sandbox - Game + Map Rules Questions Spawn diff --git a/sandbox.html b/sandbox.html index 5692adb..acaad22 100644 --- a/sandbox.html +++ b/sandbox.html @@ -11,7 +11,7 @@ Main Sandbox - Game + Map Rules Questions Spawn diff --git a/spawn.html b/spawn.html index 198b399..fcd2dfb 100644 --- a/spawn.html +++ b/spawn.html @@ -15,7 +15,7 @@ Main Sandbox - Game + Map Rules Questions Spawn