More coooode ....

This commit is contained in:
Aaron Fischer 2017-09-13 01:14:17 +02:00
parent 48a0bee23f
commit 3df5f0d766
15 changed files with 88 additions and 34 deletions

View file

@ -11,7 +11,7 @@ build:
stat: build stat: build
@filesize=`stat --printf="%s" muri.zip` && \ @filesize=`stat --printf="%s" muri.zip` && \
echo $$filesize "byte ->" $$((100*$$filesize/13000)) "%" echo $$filesize "byte ->" $$((100*$$filesize/13312)) "%"
clean: clean:
rm -f src/muri.min.js muri.zip rm -f src/muri.min.js muri.zip

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 603 B

View file

@ -49,3 +49,9 @@ canvas {
font-family: monospace; font-family: monospace;
text-transform: uppercase; text-transform: uppercase;
} }
#tryagain {
position: relative;
top: -200px;
display: none;
}

View file

@ -1 +1 @@
link rel="stylesheet" href="assets/styles.css"></link> <h1>murí</h1><p>a js13kgame by <a href="https://aaron-fischer.net/">Aaron Fischer</a> (2017)</p><div id="content"> <div> <canvas width="100" height="40" id="js13k-2017"></canvas> <div id="bubble"></div></div></div><p id="loading">loading game ...</p><script src="vendor/kontra.min.js"></script><script src="muri.min.js"></script> link rel="stylesheet" href="assets/styles.css"></link><h1>murí</h1><p>a js13kgame by <a href="https://aaron-fischer.net/">Aaron Fischer</a> (2017)</p><div id="content"><div><canvas width="100" height="40" id="js13k-2017"></canvas><div id="bubble"></div></div></div><p id="loading">loading game ...</p><a href="" id="tryagain" onclick="window.location.reload(true);">Try again</a><script src="vendor/kontra.min.js"></script><script src="muri.min.js"></script>

View file

@ -9,6 +9,7 @@
</div> </div>
</div> </div>
<p id="loading">loading game ...</p> <p id="loading">loading game ...</p>
<a href="" id="tryagain" onclick="window.location.reload(true);">Try again</a>
<script src="vendor/kontra.js"></script> <script src="vendor/kontra.js"></script>
<script src="muri.js"></script> <script src="muri.js"></script>
@ -20,3 +21,4 @@
<script src="room_hydro.js"></script> <script src="room_hydro.js"></script>
<script src="room_lift.js"></script> <script src="room_lift.js"></script>
<script src="room_stasis.js"></script> <script src="room_stasis.js"></script>
<script src="room_end.js"></script>

View file

@ -98,14 +98,23 @@ var muri = (function() {
}); });
}; };
muri.end = function(reason) {
muri.changeRoom('end');
muri.get('bubble')
.talk(reason, [20, 20])
.then(function() {
document.getElementById('tryagain').style.display = 'block';
});
};
muri.setup = function() { muri.setup = function() {
kontra.assets.load( kontra.assets.load(
'room_stasis_dark.png', 'room_stasis_dark.png',
'room_stasis.png', 'room_stasis.png',
'room_engine.png', 'room_engine.png',
'room_bridge.png',
'room_hydro.png', 'room_hydro.png',
'door_sheet.png', 'door_sheet.png',
'laser_sheet.png',
'stasis_lightSwitch.png', 'stasis_lightSwitch.png',
'room_lift.png', 'room_lift.png',
'lift_button.png' 'lift_button.png'

View file

@ -1,28 +0,0 @@
(function() {
'use strict';
var bridge = {};
var background, door = null;
var roomState = {
};
bridge.init = function() {
background = muri.bg('bridge');
door = muri.door('bridge', [83, 4]);
};
bridge.onEnter = function() {
door.sprite.playAnimation('close');
};
bridge.update = function() {
};
bridge.render = function() {
background.render();
};
bridge.name = 'bridge';
muri.rooms.push(bridge);
}());

12
src/room_end.js Normal file
View file

@ -0,0 +1,12 @@
(function() {
'use strict';
var end = {};
end.init = function() {};
end.update = function() {};
end.render = function() {};
end.name = 'end';
muri.rooms.push(end);
}());

View file

@ -3,10 +3,11 @@
var engine = {}; var engine = {};
var background, door = null; var background, door, lasers = null;
var roomState = { var roomState = {
firstVisit: true, firstVisit: true,
engineBroken: true engineBroken: true,
laserStates: [0, 0, 0]
}; };
var randomSounds = function() { var randomSounds = function() {
@ -25,9 +26,50 @@
}); });
}; };
var laser = function(i) {
var laserAnimationSheet = kontra.spriteSheet({
image: kontra.assets.images.laser_sheet,
frameWidth: 5, frameHeight: 10,
animations: {
0: {frames: 0},
1: {frames: 1},
2: {frames: 2},
}
});
var laserSprite = kontra.sprite({
x: 36+i*20, y: 14,
animations: laserAnimationSheet.animations
});
return muri.get('entity')
.create('engine.laser'+i, laserSprite)
.addCallback(function() {
if (!roomState.engineBroken) return;
var state = roomState.laserStates[i] + 1;
if (state > 2) state = 0;
laserSprite.playAnimation(state);
roomState.laserStates[i] = state;
if (roomState.laserStates[0] == 2 &&
roomState.laserStates[1] == 2 &&
roomState.laserStates[2] == 2) {
roomState.engineBroken = false;
muri.get('bubble')
.talk([
'A huge beem light up and the whole ship vibrates.',
'You\'ve made it, the engine is running again!'
]);
}
});
};
engine.init = function() { engine.init = function() {
background = muri.bg('engine'); background = muri.bg('engine');
door = muri.door('engine', [8, 10]); door = muri.door('engine', [8, 10]);
lasers = [
laser(0),
laser(1),
laser(2)
];
}; };
engine.onEnter = function() { engine.onEnter = function() {

View file

@ -36,6 +36,16 @@
return; return;
} }
if (room === 'shot') {
muri.end([
'You stepped into a pressure shot ... ',
'Which is broken on this ship.',
'It takes no more than a second to drag you into space.',
'You are lost ... ....',
'... and die.']);
return;
}
muri.get('entity').get('lift.button'+i).sprite.playAnimation('on'); muri.get('entity').get('lift.button'+i).sprite.playAnimation('on');
var goMessage = muri.ra([ var goMessage = muri.ra([
'Sure, ' + room, 'Sure, ' + room,
@ -68,7 +78,8 @@
createButtonEntity(0, 'bridge'), // Bridge createButtonEntity(0, 'bridge'), // Bridge
createButtonEntity(1, 'hydro'), // Hydro Deck createButtonEntity(1, 'hydro'), // Hydro Deck
createButtonEntity(2, 'stasis'), // Stasis createButtonEntity(2, 'stasis'), // Stasis
createButtonEntity(3, 'engine') // Engine room createButtonEntity(3, 'shot'), // Shot
createButtonEntity(4, 'engine') // Engine room
]; ];
buttons[2].sprite.playAnimation('on'); buttons[2].sprite.playAnimation('on');
}; };