set up assets for Super Tea Witch
This commit is contained in:
parent
f9b11e5833
commit
adbf13f06a
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>snej</title>
|
||||
<title>Super Tea Witch</title>
|
||||
<style>
|
||||
* { padding: 0; margin: 0; }
|
||||
body { background: black; color: white; font-family: monospace; }
|
||||
@ -35,7 +35,8 @@
|
||||
<button id="6x">6x</button>
|
||||
<button id="7x">7x</button>
|
||||
<button id="8x">8x</button>
|
||||
<img src="bundle/tf_atlantis_tiles.png" id="atlantis" style="display: none">
|
||||
<img src="bundle/terrain.png" id="terrain" style="display: none">
|
||||
<img src="bundle/witchtiles_1.png" id="witch" style="display: none">
|
||||
<img src="bundle/spritesheet.png" id="spritesheet" style="display: none">
|
||||
<script src="bundle/spritesheet.js"></script>
|
||||
<script src="main.js"></script>
|
||||
|
100
main.js
100
main.js
@ -337,25 +337,20 @@ class CharacterSprite {
|
||||
|
||||
class Resources {
|
||||
constructor() {
|
||||
const atlantis = document.getElementById('atlantis');
|
||||
const terrain = document.getElementById('terrain');
|
||||
const witch = document.getElementById('witch');
|
||||
const spritesheet = document.getElementById('spritesheet');
|
||||
const ts = 16;
|
||||
this.sprites = {
|
||||
'ground0': new Sprite(atlantis, 2 * ts, 1 * ts, 16, 16),
|
||||
'ground1': new Sprite(atlantis, 3 * ts, 1 * ts, 16, 16),
|
||||
'ground2': new Sprite(atlantis, 4 * ts, 1 * ts, 16, 16),
|
||||
'ground3': new Sprite(atlantis, 5 * ts, 1 * ts, 16, 16),
|
||||
'ground4': new Sprite(atlantis, 6 * ts, 1 * ts, 16, 16),
|
||||
'ground5': new Sprite(atlantis, 7 * ts, 1 * ts, 16, 16),
|
||||
'ground6': new Sprite(atlantis, 8 * ts, 1 * ts, 16, 16),
|
||||
'rock0': new Sprite(atlantis, 1 * ts, 2 * ts, 16, 16),
|
||||
'rock1': new Sprite(atlantis, 2 * ts, 2 * ts, 16, 16),
|
||||
'rock2': new Sprite(atlantis, 3 * ts, 2 * ts, 16, 16),
|
||||
'anchor0': new Sprite(atlantis, 21 * ts, 1 * ts, 16, 16),
|
||||
'seaweed0': new Sprite(atlantis, 20 * ts, 2 * ts, 16, 32),
|
||||
'seaweed1': new Sprite(atlantis, 16 * ts, 2 * ts, 16, 32),
|
||||
'coral0': new Sprite(atlantis, 15 * ts, 9 * ts, 32, 16),
|
||||
'rockpile0': new Sprite(atlantis, 17 * ts, 10 * ts, 32, 32),
|
||||
'ground0': new Sprite(terrain, 2 * ts, 1 * ts, 16, 16),
|
||||
'ground1': new Sprite(terrain, 3 * ts, 1 * ts, 16, 16),
|
||||
'ground2': new Sprite(terrain, 4 * ts, 1 * ts, 16, 16),
|
||||
'ground3': new Sprite(terrain, 5 * ts, 1 * ts, 16, 16),
|
||||
'ground4': new Sprite(terrain, 6 * ts, 1 * ts, 16, 16),
|
||||
'ground5': new Sprite(terrain, 2 * ts, 2 * ts, 16, 16),
|
||||
'ground6': new Sprite(terrain, 6 * ts, 2 * ts, 16, 16),
|
||||
'cauldron_blue': new Sprite(witch, 0, 0, 32, 32),
|
||||
'cauldron_green': new Sprite(witch, 32, 0, 32, 32),
|
||||
}
|
||||
|
||||
for (const key in spritesheet_json) {
|
||||
@ -372,7 +367,7 @@ class Player {
|
||||
// TODO: stop hard-coding player bounding box.
|
||||
constructor() {
|
||||
this.x = (SNES_WIDTH - 26) / 2;
|
||||
this.y = (SNES_HEIGHT - 36) / 2;
|
||||
this.y = (SNES_HEIGHT - 36) / 2 - 28;
|
||||
this.orientation = Orientation.DOWN;
|
||||
this.spriteNames_ = [];
|
||||
for (const name in spritesheet_json) {
|
||||
@ -442,38 +437,39 @@ class PlayerRenderer {
|
||||
class TileRenderer {
|
||||
draw(gfx, sprites) {
|
||||
const tileSize = 16;
|
||||
// The screen is 14 x 16 tiles by default.
|
||||
const rows = gfx.height / tileSize;
|
||||
const columns = gfx.width / tileSize;
|
||||
const layer1 = ["-,*-...*'.,-_'`o",
|
||||
"_..'-_**,',_.'oo",
|
||||
"-*-''_-'o,0O_```",
|
||||
"o`0_._,*O'`--'-'",
|
||||
"`0O-_'',`o*o*`-,",
|
||||
"*,`'---o'O'_*''-",
|
||||
"'-.**.'_'`.,'-.'",
|
||||
".O'``*``'`*,,_o`",
|
||||
"_*_''*O'`_OO-_'o",
|
||||
"0`0,*-,`_*'`O'*.",
|
||||
".o'-*.*_',`,,`.'",
|
||||
"`o`O',.`OO,*-'**",
|
||||
"-..*'-''',*'.'.O",
|
||||
"*-_'-0.--__O`O`_",
|
||||
"*-_,O_'*'`*'_._.",
|
||||
"-.*,`OO'_`'*-0-O"];
|
||||
const layer2 = [" ",
|
||||
" ",
|
||||
" iil ",
|
||||
" ",
|
||||
" A ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" i ",
|
||||
" l ",
|
||||
" ",
|
||||
" c R ",
|
||||
" c "];
|
||||
const layer1 = [
|
||||
".'...__,._..*..`",
|
||||
"*'..,_.--.,.*..`",
|
||||
"_._.*._.,.--,._.",
|
||||
"._``_.,_..._..``",
|
||||
"_,.`.....'...._`",
|
||||
"..`_'*...._.._..",
|
||||
".,'.'_-'...__.`.",
|
||||
".....,'...*,'..`",
|
||||
"__..'_......_...",
|
||||
"'*..``.,.,..,.,.",
|
||||
"...'._'*'..___..",
|
||||
"'._'.-....,.`.._",
|
||||
"_*_.*_,'-...`-..",
|
||||
".-...*._`,`'`.,."];
|
||||
const layer2 = [
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" O ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "];
|
||||
const spriteLookup = {
|
||||
'.': sprites.ground0,
|
||||
',': sprites.ground1,
|
||||
@ -482,14 +478,8 @@ class TileRenderer {
|
||||
'-': sprites.ground4,
|
||||
'*': sprites.ground5,
|
||||
"'": sprites.ground6,
|
||||
'o': sprites.rock0,
|
||||
'O': sprites.rock1,
|
||||
'0': sprites.rock2,
|
||||
'A': sprites.anchor0,
|
||||
'i': sprites.seaweed0,
|
||||
'l': sprites.seaweed1,
|
||||
'c': sprites.coral0,
|
||||
'R': sprites.rockpile0,
|
||||
'O': sprites.cauldron_blue,
|
||||
'o': sprites.cauldron_green,
|
||||
};
|
||||
for (let j = 0; j < columns; j++) {
|
||||
for (let i = 0; i < rows; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user