bacongamejam05-notsoalonein.../build/game.js

501 lines
42 KiB
JavaScript

// Generated by CoffeeScript 1.6.3
var pixel, rect, toxy, write;
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);
};
// Generated by CoffeeScript 1.6.3
var map_range, update_canvas;
update_canvas = function(width, height) {
canvas.width = width;
return canvas.height = height;
};
map_range = function(from, to, s) {
return to[0] + (s - from[0]) * (to[1] - to[0]) / (from[1] - from[0]);
};
// Generated by CoffeeScript 1.6.3
var blocks, canvas, colors, config, context, current_level, enemy_layer, gamestates, inventar, level, levels, player, selected_layer, shadow_layer;
canvas = document.getElementById('canvas');
context = canvas.getContext('2d');
context.textAlign = 'center';
gamestates = {
RUN: 'RUN',
WIN: 'WIN',
OVER: 'OVER'
};
config = {
gamestate: gamestates.RUN,
pixelsize: 15,
debug_available: true,
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'
};
inventar = {
key: false
};
levels = [];
current_level = 0;
level = null;
shadow_layer = null;
enemy_layer = null;
selected_layer = null;
// Generated by CoffeeScript 1.6.3
var add_level, draw_level, init_level, load_level, parse_levelentities, reset_layers;
add_level = function(map) {
return levels.push(map);
};
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;
window.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 window.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 level, _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.gamestate = gamestates.WIN;
} else {
init_level();
window.level = levels[number];
return parse_levelentities(level);
}
};
parse_levelentities = function(level) {
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;
};
// Generated by CoffeeScript 1.6.3
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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 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 3]);
// Generated by CoffeeScript 1.6.3
var draw_hud;
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;
};
// Generated by CoffeeScript 1.6.3
var break_walls, draw_player, update_player_position,
__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; };
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.gamestate = gamestates.OVER;
}
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);
};
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;
}
};
// Generated by CoffeeScript 1.6.3
var calculate_lightray, calculate_lights, draw_lights, illuminate,
_this = this,
__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; };
calculate_lightray = function(x1, y1, x2, y2, type) {
var dx, dy, hit_wall, pixel_x1, pixel_x2, pixel_y1, pixel_y2, s, t, _ref, _results;
switch (type) {
case 'enemy':
window.selected_layer = enemy_layer;
break;
default:
window.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, _i, _len, _ref, _results;
switch (type) {
case 'enemy':
color = '255, 0, 0';
window.selected_layer = enemy_layer;
break;
default:
color = '0, 0, 0';
window.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;
};
// Generated by CoffeeScript 1.6.3
var keymap;
keymap = [];
addEventListener('keydown', function(event) {
keymap[event.keyCode] = true;
if (event.keyCode === 187) {
config.pixelsize += 2;
update_canvas(config.map.width * config.pixelsize + config.map.origin.x, config.map.height * config.pixelsize + config.map.origin.y);
}
if (event.keyCode === 189) {
config.pixelsize -= 2;
update_canvas(config.map.width * config.pixelsize + config.map.origin.x, config.map.height * config.pixelsize + config.map.origin.y);
}
if (event.keyCode === 68 && config.debug_available) {
config.debug = !config.debug;
}
if (event.keyCode === 32) {
break_walls(player.position);
}
if (event.keyCode === 76 && config.debug_available) {
return config.lights = !config.lights;
}
});
addEventListener('keyup', function(event) {
return keymap[event.keyCode] = false;
});
// Generated by CoffeeScript 1.6.3
var loop_gameover, loop_gamewin, loop_main, loop_run,
_this = this;
loop_run = function() {
reset_layers();
calculate_lights();
draw_level(level);
update_player_position();
if (config.lights) {
draw_lights('shadow');
draw_lights('enemy');
}
draw_player(player.position);
return draw_hud();
};
loop_gamewin = function() {
rect(0, 0, config.map.width * config.pixelsize, config.map.height * config.pixelsize + config.map.origin.y, '#ffffff');
return write(250, 100, 'You won, awesome!', 20, '#000000');
};
loop_gameover = function() {
rect(0, 0, config.map.width * config.pixelsize, config.map.height * config.pixelsize + config.map.origin.y, '#ff0000');
return write(150, 100, 'Oh noes!', 20, '#ffffff');
};
loop_main = function() {
switch (config.gamestate) {
case gamestates.RUN:
loop_run();
break;
case gamestates.WIN:
loop_gamewin();
break;
case gamestates.OVER:
loop_gameover();
}
return setTimeout(loop_main, 50);
};
update_canvas(config.map.width * config.pixelsize, config.map.height * config.pixelsize + config.map.origin.y);
load_level(current_level);
loop_main();