Finish ... kind of ... now some space reduction
2
Makefile
|
@ -5,7 +5,7 @@ all: build stat clean
|
|||
build:
|
||||
rm -f muri-src.zip muri.zip src/muri.min.js
|
||||
uglifyjs --compress --mangle --no-dead-code --output src/muri.min.js src/*.js
|
||||
(cd src/assets/images; for i in `ls *.png`; do pngcrush -brute -reduce_palette -ow $$i; done)
|
||||
#(cd src/assets/images; for i in `ls *.png`; do pngcrush -brute -reduce_palette -ow $$i; done)
|
||||
(cd src && zip -q -9 ../muri.zip index.html muri.min.js assets/* assets/**/* vendor/*.min.js)
|
||||
(cd src && zip -q -9 ../muri-src.zip ./* ./**/* ./**/**/* ../README)
|
||||
|
||||
|
|
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 265 B |
BIN
src/assets/images/keycard.png
Normal file
After Width: | Height: | Size: 93 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 486 B |
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 129 B |
BIN
src/assets/images/toggleSwitch_sheet.png
Normal file
After Width: | Height: | Size: 78 B |
|
@ -1,5 +1,4 @@
|
|||
<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">
|
||||
|
@ -16,7 +15,6 @@
|
|||
<script src="entity.js"></script>
|
||||
<script src="bubble.js"></script>
|
||||
<script src="mouse.js"></script>
|
||||
<script src="room_bridge.js"></script>
|
||||
<script src="room_engine.js"></script>
|
||||
<script src="room_hydro.js"></script>
|
||||
<script src="room_lift.js"></script>
|
||||
|
|
13
src/muri.js
|
@ -98,12 +98,13 @@ var muri = (function() {
|
|||
});
|
||||
};
|
||||
|
||||
muri.end = function(reason) {
|
||||
muri.end = function(reason, again) {
|
||||
muri.changeRoom('end');
|
||||
muri.get('bubble')
|
||||
.talk(reason, [20, 20])
|
||||
.then(function() {
|
||||
document.getElementById('tryagain').style.display = 'block';
|
||||
if (again)
|
||||
document.getElementById('tryagain').style.display = 'block';
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -114,6 +115,8 @@ var muri = (function() {
|
|||
'room_engine.png',
|
||||
'room_hydro.png',
|
||||
'door_sheet.png',
|
||||
'toggleSwitch_sheet.png',
|
||||
'keycard.png',
|
||||
'laser_sheet.png',
|
||||
'stasis_lightSwitch.png',
|
||||
'room_lift.png',
|
||||
|
@ -129,7 +132,8 @@ var muri = (function() {
|
|||
|
||||
kontra.gameLoop({
|
||||
update: function() {
|
||||
muri.room(muri.currentRoom).update();
|
||||
var r = muri.room(muri.currentRoom);
|
||||
if (r.update !== undefined) r.update();
|
||||
muri.modules.forEach(function(m) {
|
||||
if (m.update !== undefined) m.update();
|
||||
});
|
||||
|
@ -140,7 +144,8 @@ var muri = (function() {
|
|||
}
|
||||
},
|
||||
render: function() {
|
||||
muri.room(muri.currentRoom).render();
|
||||
var r = muri.room(muri.currentRoom);
|
||||
if (r.render !== undefined) r.render();
|
||||
muri.modules.forEach(function(m) {
|
||||
if (m.render !== undefined && m.name !== 'entity')
|
||||
m.render();
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
var end = {};
|
||||
|
||||
end.init = function() {};
|
||||
end.update = function() {};
|
||||
end.render = function() {};
|
||||
|
||||
end.name = 'end';
|
||||
muri.rooms.push(end);
|
||||
muri.rooms.push({name: 'end'});
|
||||
}());
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
var background, door, lasers = null;
|
||||
var roomState = {
|
||||
firstVisit: true,
|
||||
engineBroken: true,
|
||||
engineBroken: false, //true,
|
||||
laserStates: [0, 0, 0]
|
||||
};
|
||||
|
||||
|
@ -88,13 +88,11 @@
|
|||
randomSounds();
|
||||
};
|
||||
|
||||
engine.update = function() {
|
||||
};
|
||||
|
||||
engine.render = function() {
|
||||
background.render();
|
||||
};
|
||||
|
||||
engine.name = 'engine';
|
||||
engine.roomState = roomState;
|
||||
muri.rooms.push(engine);
|
||||
}());
|
||||
|
|
|
@ -3,22 +3,29 @@
|
|||
|
||||
var hydro = {};
|
||||
|
||||
var background, door = null;
|
||||
var roomState = {
|
||||
};
|
||||
var background, door, keycard = null;
|
||||
|
||||
hydro.init = function() {
|
||||
background = muri.bg('hydro');
|
||||
door = muri.door('hydro', [38, 9]);
|
||||
keycard = muri.get('entity')
|
||||
.create('hydro.keycard', kontra.sprite({x: 55, y: 28, image: kontra.assets.images.keycard}))
|
||||
.addCallback(function() {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'Thats interesting ... ',
|
||||
'The keycard from the captain.',
|
||||
'That can be handy some day.'
|
||||
]);
|
||||
muri.room('lift').roomState.bridgeAccessible = true;
|
||||
muri.get('entity').get('hydro.keycard').invisible = true;
|
||||
});
|
||||
};
|
||||
|
||||
hydro.onEnter = function() {
|
||||
door.sprite.playAnimation('close');
|
||||
};
|
||||
|
||||
hydro.update = function() {
|
||||
};
|
||||
|
||||
hydro.render = function() {
|
||||
background.render();
|
||||
};
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
hydroDoorBroken: true
|
||||
};
|
||||
|
||||
|
||||
var createButtonEntity = function(i, room) {
|
||||
var e = muri.get('entity')
|
||||
.create('lift.button'+i,
|
||||
|
@ -18,19 +17,33 @@
|
|||
animations: buttonSheet.animations}))
|
||||
.addCallback(function() {
|
||||
buttons.forEach(function(b) { b.sprite.playAnimation('off'); });
|
||||
|
||||
if (room === 'bridge' && !roomState.bridgeAccessible) {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'The bridge is not accessible.',
|
||||
'You have no sufficient permission to do that.']);
|
||||
if (room === 'bridge') {
|
||||
if (!roomState.bridgeAccessible) {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'The bridge is not accessible.',
|
||||
'You have no sufficient permission to do that.']);
|
||||
} else {
|
||||
muri.end([
|
||||
'You\'ve made it all the way to the bridge.',
|
||||
'The engine is running fine.',
|
||||
'You can finally head home and leave this rotten ship.',
|
||||
'... ',
|
||||
'You crank the throttle all the way up.',
|
||||
'...',
|
||||
'...',
|
||||
'The ship burst apart.',
|
||||
'You are lost.',
|
||||
'Lost from the very beginning.'
|
||||
], false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (room === 'hydro' && roomState.hydroDoorBroken) {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'The hyperlift moved, but to door to the hydro deck does not open.',
|
||||
'The hyperlift moved, but the door to the hydro deck does not open.',
|
||||
'You can\'t access this deck with a broken door.'
|
||||
]);
|
||||
return;
|
||||
|
@ -42,7 +55,7 @@
|
|||
'Which is broken on this ship.',
|
||||
'It takes no more than a second to drag you into space.',
|
||||
'You are lost ... ....',
|
||||
'... and die.']);
|
||||
'... and die.'], true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,12 +107,11 @@
|
|||
muri.get('bubble').talk([welcomeMessage]);
|
||||
};
|
||||
|
||||
lift.update = function() {};
|
||||
|
||||
lift.render = function() {
|
||||
background.render();
|
||||
};
|
||||
|
||||
lift.name = 'lift';
|
||||
lift.roomState = roomState;
|
||||
muri.rooms.push(lift);
|
||||
}());
|
||||
|
|
|
@ -4,11 +4,61 @@
|
|||
var stasis = {};
|
||||
|
||||
var background, backgroundDark = null;
|
||||
var door = null;
|
||||
var door, liftBox = null;
|
||||
var roomState = {
|
||||
isDoorOpen: false,
|
||||
isLightOn: false,
|
||||
isIntroRunning: true
|
||||
isLightOn: true, //false
|
||||
isIntroRunning: false, //true
|
||||
hydroDoorBroken: false, // true
|
||||
liftSwitches: ['off', 'off', 'off', 'off', 'off']
|
||||
};
|
||||
|
||||
var toggleLiftSwitch = function(i) {
|
||||
if (!roomState.hydroDoorBroken) return;
|
||||
var state = roomState.liftSwitches[i];
|
||||
var newState = state == 'on' ? 'off' : 'on';
|
||||
muri.get('entity').get('stasis.liftSwitch'+i).sprite.playAnimation(newState);
|
||||
roomState.liftSwitches[i] = newState;
|
||||
};
|
||||
|
||||
var liftSwitch = function(i) {
|
||||
var switchAnimation = kontra.spriteSheet({
|
||||
image: kontra.assets.images.toggleSwitch_sheet,
|
||||
frameWidth: 2, frameHeight: 1,
|
||||
animations: {
|
||||
'off': {frames: 0},
|
||||
'on': {frames: 1}
|
||||
}
|
||||
});
|
||||
var liftSwitch = kontra.sprite({
|
||||
x: 95, y: 16+i*2,
|
||||
animations: switchAnimation.animations
|
||||
});
|
||||
|
||||
return muri.get('entity')
|
||||
.create('stasis.liftSwitch'+i, liftSwitch)
|
||||
.addCallback(function() {
|
||||
toggleLiftSwitch(i);
|
||||
var randomSwitch = Math.floor(Math.random()*roomState.liftSwitches.length);
|
||||
if (randomSwitch !== i)
|
||||
toggleLiftSwitch(randomSwitch);
|
||||
|
||||
var solved = true;
|
||||
console.log(roomState.liftSwitches);
|
||||
roomState.liftSwitches.forEach(function(s) {
|
||||
console.log(s);
|
||||
if (s === 'off') solved = false;
|
||||
});
|
||||
if (solved) {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'Once again, the ship shakes like crazy.',
|
||||
'Something broke or looses inside the lift and metal scrapes against the hull.',
|
||||
'Not sure if this is a good sign ...']);
|
||||
muri.room('lift').roomState.hydroDoorBroken = false;
|
||||
roomState.hydroDoorBroken = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
stasis.init = function() {
|
||||
|
@ -66,13 +116,22 @@
|
|||
]);
|
||||
})
|
||||
.invisible = true;
|
||||
|
||||
}
|
||||
|
||||
if (!muri.room('engine').roomState.engineBroken && !liftBox) {
|
||||
liftBox = kontra.sprite({x: 94, y: 15, width: 4, height: 11, color: '#000'});
|
||||
liftSwitch(0);
|
||||
liftSwitch(1);
|
||||
liftSwitch(2);
|
||||
liftSwitch(3);
|
||||
liftSwitch(4);
|
||||
}
|
||||
};
|
||||
|
||||
stasis.render = function() {
|
||||
if (roomState.isLightOn) {
|
||||
background.render();
|
||||
if (liftBox) liftBox.render();
|
||||
} else {
|
||||
backgroundDark.render();
|
||||
}
|
||||
|
|