From c1ac81a24b8d1a20bd77ff33ad670cc92291d6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20M=C3=BCller?= Date: Mon, 10 Jun 2013 16:59:29 +0200 Subject: [PATCH] initial --- build/game.js | 459 +++++++++++++++++++++++++++ build/index.html | 11 + build/notsoaloneinthedark-game.html | 470 ++++++++++++++++++++++++++++ compile.bat | 2 + compile.sh | 1 + docs/IDEAS | 15 + docs/TODO | 28 ++ maps/Map_Kurs_01 | 1 + src/Cakefile | 5 + src/base.coffee | 70 +++++ src/hud.coffee | 17 + src/levels/level_0.coffee.xx | 1 + src/levels/level_1.coffee | 1 + src/levels/level_2.coffee | 1 + src/levels/level_3.coffee | 2 + src/levels/level_4.coffee | 2 + src/main.coffee | 247 +++++++++++++++ 17 files changed, 1333 insertions(+) create mode 100644 build/game.js create mode 100644 build/index.html create mode 100644 build/notsoaloneinthedark-game.html create mode 100644 compile.bat create mode 100755 compile.sh create mode 100644 docs/IDEAS create mode 100644 docs/TODO create mode 100644 maps/Map_Kurs_01 create mode 100644 src/Cakefile create mode 100644 src/base.coffee create mode 100644 src/hud.coffee create mode 100644 src/levels/level_0.coffee.xx create mode 100644 src/levels/level_1.coffee create mode 100644 src/levels/level_2.coffee create mode 100644 src/levels/level_3.coffee create mode 100644 src/levels/level_4.coffee create mode 100644 src/main.coffee diff --git a/build/game.js b/build/game.js new file mode 100644 index 0000000..1bf0c8d --- /dev/null +++ b/build/game.js @@ -0,0 +1,459 @@ +// Generated by CoffeeScript 1.6.3 +(function() { + var add_level, blocks, break_walls, calculate_lightray, calculate_lights, canvas, colors, config, context, current_level, draw_hud, draw_level, draw_lights, draw_player, enemy_layer, illuminate, init_level, inventar, keymap, level, levels, load_level, main_loop, map_range, parse_levelentities, pixel, player, rect, reset_layers, shadow_layer, toxy, update_canvas, update_player_position, write, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + canvas = document.getElementById('canvas'); + + context = canvas.getContext('2d'); + + context.textAlign = 'center'; + + config = { + gamewin: false, + gameover: false, + pixelsize: 15, + debug: false, + lights: true, + map: { + width: 60, + height: 40, + origin: { + x: 0, + y: 50 + } + } + }; + + player = { + position: 0, + lightrange: 10 + }; + + blocks = { + walkable: [1, 0, 4, 6, 7, 8], + entities: [1, 2, 7, 5, 6, 8] + }; + + colors = { + floor: '#eeeeee', + wall: '#333333', + player: '#850091', + key: '#ffe91a', + door: '#0883fd', + exit: '#07fd0f', + breakable: '#bf7d0b' + }; + + levels = []; + + current_level = 0; + + level = null; + + update_canvas = function() { + canvas.width = config.map.width * config.pixelsize + config.map.origin.x; + return canvas.height = config.map.height * config.pixelsize + config.map.origin.y; + }; + + update_canvas(); + + toxy = function(position) { + return { + x: position % config.map.width, + y: Math.floor(position / config.map.width) + }; + }; + + rect = function(x, y, w, h, color) { + context.fillStyle = color; + return context.fillRect(x, y, w, h); + }; + + pixel = function(position, w, h, color) { + var x, y; + x = config.pixelsize * toxy(position).x + config.map.origin.x; + y = config.pixelsize * toxy(position).y + config.map.origin.y; + return rect(x, y, w, h, color); + }; + + write = function(x, y, text, size, color) { + context.textAlign = 'center'; + context.fillStyle = color; + context.font = 'normal ' + size + 'pt Verdana'; + return context.fillText(text, x, y); + }; + + add_level = function(map) { + return levels.push(map); + }; + + shadow_layer = enemy_layer = level = null; + + inventar = { + key: false + }; + + draw_hud = function() { + var color, i, name, _results; + rect(0, 0, config.pixelsize * config.map.width, config.map.origin.y, '#222222'); + rect(0, config.map.origin.y - 2, config.pixelsize * config.map.width, 2, '#333333'); + i = 0; + _results = []; + for (name in inventar) { + color = '#aaaaaa'; + if (inventar[name]) { + color = colors[name]; + } + rect(i * 43 + 15, 8, 25, 25, color); + write(i * 43 + 15 + 12, 45, name, 7, color); + _results.push(i++); + } + return _results; + }; + + add_level([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3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 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 3]); + + draw_level = function(level) { + var block, color, position, _i, _len, _results; + _results = []; + for (position = _i = 0, _len = level.length; _i < _len; position = ++_i) { + block = level[position]; + switch (block) { + case 0: + color = colors.floor; + break; + case 3: + color = colors.wall; + break; + case 1: + color = colors.key; + break; + case 2: + color = colors.door; + break; + case 7: + color = colors.exit; + break; + case 5: + color = colors.breakable; + } + _results.push(pixel(position, config.pixelsize, config.pixelsize, color)); + } + return _results; + }; + + reset_layers = function() { + var _i, _j, _ref, _ref1, _results, _results1; + shadow_layer = (function() { + _results = []; + for (var _i = 0, _ref = config.map.width * config.map.height; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); } + return _results; + }).apply(this).map(function() { + return 0; + }); + return enemy_layer = (function() { + _results1 = []; + for (var _j = 0, _ref1 = config.map.width * config.map.height; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; 0 <= _ref1 ? _j++ : _j--){ _results1.push(_j); } + return _results1; + }).apply(this).map(function() { + return 0; + }); + }; + + init_level = function() { + var _i, _ref, _results; + level = (function() { + _results = []; + for (var _i = 0, _ref = config.map.width * config.map.height; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); } + return _results; + }).apply(this).map(function() { + return 0; + }); + return inventar.key = false; + }; + + load_level = function(number) { + if (number === levels.length) { + return config.gamewin = true; + } else { + init_level(); + level = levels[number]; + return parse_levelentities(level); + } + }; + + update_player_position = function() { + var new_position, _ref; + new_position = player.position; + if (keymap[37] && toxy(player.position).x > 0) { + new_position = new_position - 1; + } + if (keymap[39] && toxy(player.position).x < config.map.width - 1) { + new_position = new_position + 1; + } + if (keymap[38] && toxy(player.position).y > 0) { + new_position = new_position - config.map.width; + } + if (keymap[40] && toxy(player.position).y < config.map.height - 1) { + new_position = new_position + config.map.width; + } + switch (level[new_position]) { + case 7: + current_level++; + load_level(current_level); + return; + case 2: + if (inventar.key) { + inventar.key = false; + level[new_position] = 0; + } + break; + case 1: + inventar.key = true; + level[new_position] = 0; + } + if (enemy_layer[new_position] > 0 && !config.debug) { + config.gameover = true; + } + if (_ref = level[new_position], __indexOf.call(blocks.walkable, _ref) >= 0) { + return player.position = new_position; + } + }; + + draw_player = function(position) { + return pixel(position, config.pixelsize, config.pixelsize, colors.player); + }; + + map_range = function(from, to, s) { + return to[0] + (s - from[0]) * (to[1] - to[0]) / (from[1] - from[0]); + }; + + calculate_lightray = function(x1, y1, x2, y2, type) { + var dx, dy, hit_wall, pixel_x1, pixel_x2, pixel_y1, pixel_y2, s, selected_layer, t, _ref, _results; + switch (type) { + case 'enemy': + selected_layer = enemy_layer; + break; + default: + selected_layer = shadow_layer; + } + pixel_x1 = x1 * config.pixelsize + (config.pixelsize / 2); + pixel_y1 = y1 * config.pixelsize + (config.pixelsize / 2); + pixel_x2 = x2 * config.pixelsize + (config.pixelsize / 2); + pixel_y2 = y2 * config.pixelsize + (config.pixelsize / 2); + dx = Math.abs(pixel_x1 - pixel_x2); + dy = Math.abs(pixel_y1 - pixel_y2); + s = 0.99 / (dx > dy ? dx : dy); + t = 0.0; + if (config.debug) { + context.beginPath(); + context.strokeStyle = 'blue'; + context.moveTo(pixel_x1 + config.map.origin.x, pixel_y1 + config.map.origin.y); + context.lineTo(pixel_x2 + config.map.origin.x, pixel_y2 + config.map.origin.y); + context.stroke(); + } + hit_wall = false; + _results = []; + while (t < 1.0) { + dx = Math.round((1.0 - t) * pixel_x1 + t * pixel_x2); + dy = Math.round((1.0 - t) * pixel_y1 + t * pixel_y2); + dx = Math.floor(dx / config.pixelsize); + dy = Math.floor(dy / config.pixelsize); + if (level[dy * config.map.width + dx] === 0) { + if (hit_wall && !config.debug) { + break; + } + if (selected_layer[dy * config.map.width + dx] === 0) { + if (t > 0.5) { + selected_layer[dy * config.map.width + dx] += map_range([0.5, 1], [1, 0], t); + } else { + selected_layer[dy * config.map.width + dx] += 1; + } + } + } else if (level[dy * config.map.width + dx] === 3) { + if (type === 'enemy') { + break; + } + if (t > 0.5) { + selected_layer[dy * config.map.width + dx] += map_range([0.5, 1], [1, 0], t); + } else { + selected_layer[dy * config.map.width + dx] += 1; + } + hit_wall = true; + } else if (_ref = level[dy * config.map.width + dx], __indexOf.call(blocks.entities, _ref) >= 0) { + if (t > 0.5) { + selected_layer[dy * config.map.width + dx] += map_range([0.5, 1], [1, 0], t); + } else { + selected_layer[dy * config.map.width + dx] += 1; + } + if (!config.debug && level[dy * config.map.width + dx] !== 1 && level[dy * config.map.width + dx] !== 8) { + break; + } + } else { + selected_layer[dy * config.map.width + dx] = .5; + if (!config.debug) { + break; + } + } + _results.push(t += s); + } + return _results; + }; + + illuminate = function(x1, y1, range, type) { + var r, x2, y2, _results; + if (type == null) { + type = 'shadow'; + } + r = 0; + _results = []; + while (r < Math.PI * 2) { + x2 = range * Math.cos(r) + x1; + y2 = range * Math.sin(r) + y1; + calculate_lightray(x1, y1, x2, y2, type); + _results.push(r += 0.03); + } + return _results; + }; + + calculate_lights = function() { + var block, position, _i, _len, _results; + illuminate(toxy(player.position).x, toxy(player.position).y, player.lightrange); + _results = []; + for (position = _i = 0, _len = level.length; _i < _len; position = ++_i) { + block = level[position]; + switch (block) { + case 8: + _results.push(illuminate(toxy(position).x, toxy(position).y, 4, 'enemy')); + break; + default: + _results.push(void 0); + } + } + return _results; + }; + + draw_lights = function(type) { + var alpha, brightness, color, position, selected_layer, _i, _len, _ref, _results; + switch (type) { + case 'enemy': + color = '255, 0, 0'; + selected_layer = enemy_layer; + break; + default: + color = '0, 0, 0'; + selected_layer = shadow_layer; + } + _results = []; + for (position = _i = 0, _len = selected_layer.length; _i < _len; position = ++_i) { + brightness = selected_layer[position]; + switch (type) { + case 'enemy': + alpha = brightness * .5; + break; + default: + alpha = 1 - brightness; + } + if (_ref = level[position], __indexOf.call(blocks.entities, _ref) >= 0) { + if (alpha < 0.4) { + alpha = 0; + } + } + _results.push(pixel(position, config.pixelsize, config.pixelsize, 'rgba(' + color + ', ' + alpha + ')')); + } + return _results; + }; + + break_walls = function(position) { + if (level[position - 1] === 5 || config.debug) { + level[position - 1] = 0; + } + if (level[position + 1] === 5 || config.debug) { + level[position + 1] = 0; + } + if (level[position - config.map.width] === 5 || config.debug) { + level[position - config.map.width] = 0; + } + if (level[position + config.map.width] === 5 || config.debug) { + return level[position + config.map.width] = 0; + } + }; + + keymap = []; + + addEventListener('keydown', function(event) { + keymap[event.keyCode] = true; + if (event.keyCode === 187) { + config.pixelsize += 2; + update_canvas(); + } + if (event.keyCode === 189) { + config.pixelsize -= 2; + update_canvas(); + } + if (event.keyCode === 68) { + config.debug = !config.debug; + } + if (event.keyCode === 32) { + break_walls(player.position); + } + if (event.keyCode === 76) { + return config.lights = !config.lights; + } + }); + + addEventListener('keyup', function(event) { + return keymap[event.keyCode] = false; + }); + + parse_levelentities = function() { + var block, position, _i, _len, _results; + _results = []; + for (position = _i = 0, _len = level.length; _i < _len; position = ++_i) { + block = level[position]; + switch (block) { + case 4: + player.position = position; + _results.push(level[position] = 0); + break; + default: + _results.push(void 0); + } + } + return _results; + }; + + load_level(current_level); + + main_loop = function() { + if (config.gamewin) { + rect(0, 0, config.map.width * config.pixelsize, config.map.height * config.pixelsize + config.map.origin.y, '#ffffff'); + write(250, 100, 'You won, awesome!', 20, '#000000'); + } else if (config.gameover) { + rect(0, 0, config.map.width * config.pixelsize, config.map.height * config.pixelsize + config.map.origin.y, '#ff0000'); + write(150, 100, 'Oh noes!', 20, '#ffffff'); + } else { + reset_layers(); + calculate_lights(); + draw_level(level); + update_player_position(); + if (config.lights) { + draw_lights('shadow'); + draw_lights('enemy'); + } + draw_player(player.position); + draw_hud(); + } + return setTimeout(main_loop, 50); + }; + + main_loop(); + +}).call(this); diff --git a/build/index.html b/build/index.html new file mode 100644 index 0000000..a307c28 --- /dev/null +++ b/build/index.html @@ -0,0 +1,11 @@ + + + + jar + + + + + + + \ No newline at end of file diff --git a/build/notsoaloneinthedark-game.html b/build/notsoaloneinthedark-game.html new file mode 100644 index 0000000..0e1019d --- /dev/null +++ b/build/notsoaloneinthedark-game.html @@ -0,0 +1,470 @@ + + + + jar + + + + + + + \ No newline at end of file diff --git a/compile.bat b/compile.bat new file mode 100644 index 0000000..50420a5 --- /dev/null +++ b/compile.bat @@ -0,0 +1,2 @@ +@ECHO off +coffee --join build\game.js --compile src\ \ No newline at end of file diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..a8858f5 --- /dev/null +++ b/compile.sh @@ -0,0 +1 @@ +coffee -o build -c src/main.coffee \ No newline at end of file diff --git a/docs/IDEAS b/docs/IDEAS new file mode 100644 index 0000000..b2e695c --- /dev/null +++ b/docs/IDEAS @@ -0,0 +1,15 @@ ++ Wände bröckelig ++ Karte + ++ Knicklicht (wird schwächer) ++ Taschenlampe ++ Feuerzeug (wird heiß) ++ Magnesiumbrennstab ++ Stirnlampe ++ Flashbang ++ Fackeln ++ Kerzen (flackern, endet) ++ Roboter ++ Glühwürmchen (einzeln oder gesamt) + ++ WASD Controls \ No newline at end of file diff --git a/docs/TODO b/docs/TODO new file mode 100644 index 0000000..79b4421 --- /dev/null +++ b/docs/TODO @@ -0,0 +1,28 @@ + ++ levelweschel start ++ + + + + + + + + + + + + + ++ loose screen + + + ++ böses licht + ++ items + - knicklicht + - feuerzeug + - fackel + ++ schatten addieren \ No newline at end of file diff --git a/maps/Map_Kurs_01 b/maps/Map_Kurs_01 new file mode 100644 index 0000000..601d3ad --- /dev/null +++ b/maps/Map_Kurs_01 @@ -0,0 +1 @@ +[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,6,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,3,0,0,0,0,0,0,0,3,0,0,0,3,3,3,3,3,3,0,0,3,0,0,0,3,0,0,3,0,0,3,0,0,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,0,0,0,1,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,6,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3] \ No newline at end of file diff --git a/src/Cakefile b/src/Cakefile new file mode 100644 index 0000000..eba5759 --- /dev/null +++ b/src/Cakefile @@ -0,0 +1,5 @@ +{exec} = require 'child_process' +task 'sbuild', 'Build project from ./*.coffee to ../build/*.js', -> + exec 'coffee --output ../build/ --join game.js --compile ./', (err, stdout, stderr) -> + throw err if err + console.log stdout + stderr \ No newline at end of file diff --git a/src/base.coffee b/src/base.coffee new file mode 100644 index 0000000..2436faf --- /dev/null +++ b/src/base.coffee @@ -0,0 +1,70 @@ +canvas = document.getElementById 'canvas' +context = canvas.getContext '2d' +context.textAlign = 'center'; + +# the config +config = + gamewin: false + gameover: false + pixelsize: 15 + debug: false + lights: true + map: + width: 60 + height: 40 + origin: + x: 0 + y: 50 + +player = + position: 0 + lightrange: 10 + +blocks = + walkable: [1, 0, 4, 6, 7, 8] + entities: [1, 2, 7, 5, 6, 8] + +colors = + floor: '#eeeeee' + wall: '#333333' + player: '#850091' + key: '#ffe91a' + door: '#0883fd' + exit: '#07fd0f' + breakable: '#bf7d0b' + +levels = [] +current_level = 0 +level = null + +# preparing the canvas +update_canvas = () -> + canvas.width = config.map.width*config.pixelsize+config.map.origin.x + canvas.height = config.map.height*config.pixelsize+config.map.origin.y +update_canvas() + +toxy = (position)-> + x: position%config.map.width + y: Math.floor(position/config.map.width) + +# function: rect drawing +rect = (x, y, w, h, color) -> + context.fillStyle = color + context.fillRect x, y, w, h + +pixel = (position, w, h, color) -> + x = config.pixelsize*toxy(position).x+config.map.origin.x + y = config.pixelsize*toxy(position).y+config.map.origin.y + rect(x, y, w, h, color) + +write = (x, y, text, size, color) -> + context.textAlign = 'center'; + context.fillStyle = color + context.font = 'normal '+size+'pt Verdana' + context.fillText(text, x, y) + +add_level = (map) -> + levels.push map + +# tmp: level +shadow_layer = enemy_layer = level = null \ No newline at end of file diff --git a/src/hud.coffee b/src/hud.coffee new file mode 100644 index 0000000..91cc94a --- /dev/null +++ b/src/hud.coffee @@ -0,0 +1,17 @@ +inventar = + key: false + #candles: 0 + #sticks: 0 + #lighter: false + +draw_hud = -> + rect(0, 0, config.pixelsize*config.map.width, config.map.origin.y, '#222222') + rect(0, config.map.origin.y-2, config.pixelsize*config.map.width, 2, '#333333') + i = 0 + for name of inventar + color = '#aaaaaa' + color = colors[name] if inventar[name] + + rect(i*43+15, 8, 25, 25, color) + write(i*43+15+12, 45, name, 7, color) + i++ \ No newline at end of file diff --git a/src/levels/level_0.coffee.xx b/src/levels/level_0.coffee.xx new file mode 100644 index 0000000..ee267da --- /dev/null +++ b/src/levels/level_0.coffee.xx @@ -0,0 +1 @@ +add_level [3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,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3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,8,0,0,0,0,0,3,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,3,3,3,3,3,3,3,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,3,0,0,0,3,0,8,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,3,3] + diff --git a/src/main.coffee b/src/main.coffee new file mode 100644 index 0000000..67b9906 --- /dev/null +++ b/src/main.coffee @@ -0,0 +1,247 @@ +draw_level = (level) -> + for block, position in level + switch block + when 0 then color = colors.floor + when 3 then color = colors.wall + when 1 then color = colors.key + when 2 then color = colors.door + when 7 then color = colors.exit + when 5 then color = colors.breakable + + pixel(position, config.pixelsize, config.pixelsize, color) + +reset_layers = () -> + shadow_layer = [0..(config.map.width*config.map.height)].map -> 0 + enemy_layer = [0..(config.map.width*config.map.height)].map -> 0 + +init_level = () -> + level = [0..(config.map.width*config.map.height)].map -> 0 + + inventar.key = false + +load_level = (number) -> + if number is levels.length + config.gamewin = true + else + init_level() + level = levels[number] + parse_levelentities(level) + +# function: update player position +update_player_position = () -> + new_position = player.position + if keymap[37] and toxy(player.position).x > 0 # left + new_position = new_position-1 + if keymap[39] and toxy(player.position).x < config.map.width-1 # right + new_position = new_position+1 + if keymap[38] and toxy(player.position).y > 0 # up + new_position = new_position - config.map.width + if keymap[40] and toxy(player.position).y < config.map.height-1 # down + new_position = new_position + config.map.width + + switch level[new_position] + # EXIT + when 7 + current_level++ + load_level(current_level) + return + # DOOR + when 2 + if inventar.key + inventar.key = false + level[new_position] = 0 + # KEY + when 1 + inventar.key = true + level[new_position] = 0 + + #console.log enemy_layer + if enemy_layer[new_position] > 0 and !config.debug + config.gameover = true + + if level[new_position] in blocks.walkable then player.position = new_position + +# function: draw player +draw_player = (position) -> + pixel(position, config.pixelsize, config.pixelsize, colors.player) + +map_range = (from, to, s) -> + to[0] + (s-from[0]) * (to[1] - to[0]) / (from[1] - from[0]) + +calculate_lightray = (x1, y1, x2, y2, type) -> + switch type + when 'enemy' then selected_layer = enemy_layer + else selected_layer = shadow_layer + + pixel_x1 = x1*config.pixelsize + (config.pixelsize/2) + pixel_y1 = y1*config.pixelsize + (config.pixelsize/2) + pixel_x2 = x2*config.pixelsize + (config.pixelsize/2) + pixel_y2 = y2*config.pixelsize + (config.pixelsize/2) + + dx = Math.abs(pixel_x1 - pixel_x2) + dy = Math.abs(pixel_y1 - pixel_y2) + + s = 0.99 / (if dx>dy then dx else dy) + t = 0.0 + + # show me the rays + if config.debug + context.beginPath() + context.strokeStyle = 'blue' + context.moveTo(pixel_x1+config.map.origin.x,pixel_y1+config.map.origin.y) + context.lineTo(pixel_x2+config.map.origin.x,pixel_y2+config.map.origin.y) + context.stroke() + + hit_wall = false + while t < 1.0 + dx = Math.round((1.0-t)*pixel_x1 + t*pixel_x2) + dy = Math.round((1.0-t)*pixel_y1 + t*pixel_y2) + + dx = Math.floor(dx/config.pixelsize) + dy = Math.floor(dy/config.pixelsize) + + # FLOOR? + if level[dy*config.map.width + dx] is 0 + break if hit_wall and !config.debug + + if selected_layer[dy*config.map.width + dx] == 0 + if t > 0.5 + selected_layer[dy*config.map.width + dx] += map_range([0.5, 1], [1, 0], t) + else + selected_layer[dy*config.map.width + dx] += 1 + # WALL? + else if level[dy*config.map.width + dx] is 3 + break if type is 'enemy' + if t > 0.5 + selected_layer[dy*config.map.width + dx] += map_range([0.5, 1], [1, 0], t) + else + selected_layer[dy*config.map.width + dx] += 1 + + hit_wall = true + # ENTITIY? + else if level[dy*config.map.width + dx] in blocks.entities + if t > 0.5 + selected_layer[dy*config.map.width + dx] += map_range([0.5, 1], [1, 0], t) + else + selected_layer[dy*config.map.width + dx] += 1 + break if !config.debug and level[dy*config.map.width + dx] isnt 1 and level[dy*config.map.width + dx] isnt 8 + else + selected_layer[dy*config.map.width + dx] = .5 + break if !config.debug + + t += s + +illuminate = (x1, y1, range, type = 'shadow') -> + r = 0 + + while r < Math.PI*2 + x2 = range*Math.cos(r) + x1 + y2 = range*Math.sin(r) + y1 + + # bug: edge blurry stuff + #x2 = config.map.width-1 if x2 > config.map.width-1 + #y2 = config.map.height-1 if y2 > config.map.height-1 + # + #x2 = 0 if x2 < 0 + #y2 = 0 if y2 < 0 + + calculate_lightray(x1, y1, x2, y2, type) + r += 0.03 + +calculate_lights = () -> + #illuminate(8, 8, 5) + illuminate(toxy(player.position).x, toxy(player.position).y, player.lightrange) + + for block, position in level + switch block + # 6 = LIGHT + # CAMERA + when 8 + illuminate(toxy(position).x, toxy(position).y, 4, 'enemy') + +draw_lights = (type) -> + switch type + when 'enemy' + color = '255, 0, 0' + selected_layer = enemy_layer + else + color = '0, 0, 0' + selected_layer = shadow_layer + + for brightness, position in selected_layer + switch type + when 'enemy' + alpha = brightness*.5 + else + alpha = 1-brightness + + if level[position] in blocks.entities + if alpha < 0.4 then alpha = 0 + + pixel(position, config.pixelsize, config.pixelsize, 'rgba('+color+', '+alpha+')') + +break_walls = (position) -> + level[position-1] = 0 if level[position-1] is 5 or config.debug + level[position+1] = 0 if level[position+1] is 5 or config.debug + level[position-config.map.width] = 0 if level[position-config.map.width] is 5 or config.debug + level[position+config.map.width] = 0 if level[position+config.map.width] is 5 or config.debug + +# get input +keymap = [] + +addEventListener 'keydown', (event) -> + keymap[event.keyCode] = true + + #console.log event.keyCode + #if event.keyCode == 187 then player.lightrange++ + if event.keyCode == 187 + config.pixelsize += 2 + update_canvas() + #current_level++ + #load_level(current_level) + #if event.keyCode == 189 then player.lightrange-- + if event.keyCode == 189 + config.pixelsize -= 2 + update_canvas() + if event.keyCode == 68 then config.debug = !config.debug + if event.keyCode == 32 then break_walls(player.position) + if event.keyCode == 76 then config.lights = !config.lights + +addEventListener 'keyup', (event) -> + keymap[event.keyCode] = false + +parse_levelentities = -> + for block, position in level + switch block + when 4 + player.position = position + level[position] = 0 + +# startup config +load_level(current_level) + +# the awesome main loop +main_loop = -> + if config.gamewin + rect(0, 0, config.map.width*config.pixelsize, config.map.height*config.pixelsize+config.map.origin.y, '#ffffff') + write(250, 100, 'You won, awesome!', 20, '#000000') + else if config.gameover + rect(0, 0, config.map.width*config.pixelsize, config.map.height*config.pixelsize+config.map.origin.y, '#ff0000') + write(150, 100, 'Oh noes!', 20, '#ffffff') + else + reset_layers() + calculate_lights() + + draw_level(level) + update_player_position() + + if config.lights + draw_lights('shadow') + draw_lights('enemy') + + draw_player(player.position) + draw_hud() + + setTimeout main_loop, 50 + +main_loop() \ No newline at end of file