Work on the actual game haha
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 566 B After Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 104 B |
|
@ -16,7 +16,7 @@
|
|||
var parts = text.split(' ');
|
||||
var showFragment = function() {
|
||||
if (parts.length === 0) {
|
||||
delayTimer = setTimeout(resolve, 3000);
|
||||
delayTimer = setTimeout(resolve, 1500);
|
||||
return;
|
||||
}
|
||||
dom.innerHTML += parts.shift() + ' ';
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
addCallback: function(callback) {
|
||||
this.callbacks.push(callback);
|
||||
return this;
|
||||
}
|
||||
},
|
||||
invisible: false
|
||||
};
|
||||
allEntities.push(e);
|
||||
return e;
|
||||
|
@ -44,7 +45,7 @@
|
|||
|
||||
entity.render = function() {
|
||||
allEntities.forEach(function(e) {
|
||||
if (e.name.split('.')[0] === muri.currentRoom)
|
||||
if (e.name.split('.')[0] === muri.currentRoom && !e.invisible)
|
||||
e.sprite.render();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -45,6 +45,10 @@ var muri = (function() {
|
|||
|
||||
var muri = {};
|
||||
|
||||
muri.ra = function(a) {
|
||||
return a[Math.floor(Math.random()*a.length)];
|
||||
};
|
||||
|
||||
muri.bg = function(room) {
|
||||
return kontra.sprite({
|
||||
x: 0, y: 0,
|
||||
|
|
|
@ -5,6 +5,24 @@
|
|||
|
||||
var background, door = null;
|
||||
var roomState = {
|
||||
firstVisit: true,
|
||||
engineBroken: true
|
||||
};
|
||||
|
||||
var randomSounds = function() {
|
||||
var sound = muri.ra(['Brrz ...', 'EeeeKK!', 'Rrrrrm deng', 'Ponk, Ponk, Deng.', 'Uffz', 'Pok, Pok, Pok, ...']);
|
||||
var position = [
|
||||
30+Math.floor(Math.random()*50),
|
||||
12+Math.floor(Math.random()*20)
|
||||
];
|
||||
|
||||
muri.get('bubble')
|
||||
.talk([sound], position)
|
||||
.then(function() {
|
||||
if (roomState.engineBroken &&
|
||||
muri.currentRoom === 'engine')
|
||||
randomSounds();
|
||||
});
|
||||
};
|
||||
|
||||
engine.init = function() {
|
||||
|
@ -14,6 +32,18 @@
|
|||
|
||||
engine.onEnter = function() {
|
||||
door.sprite.playAnimation('close');
|
||||
if (roomState.firstVisit) {
|
||||
roomState.firstVisit = false;
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'It smells like molted plastic and burned metal in here.',
|
||||
'Something is broken here for sure.',
|
||||
'I\'m afraid that I need to fix this mess somehow ...'
|
||||
]);
|
||||
}
|
||||
|
||||
if (roomState.engineBroken)
|
||||
randomSounds();
|
||||
};
|
||||
|
||||
engine.update = function() {
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
var buttonSheet, background = null;
|
||||
var buttons = [];
|
||||
var roomState = {
|
||||
position: 1
|
||||
bridgeAccessible: false,
|
||||
hydroDoorBroken: true
|
||||
};
|
||||
|
||||
var r = function(a) {
|
||||
return a[Math.floor(Math.random()*a.length)];
|
||||
};
|
||||
|
||||
var createButtonEntity = function(i, room) {
|
||||
var e = muri.get('entity')
|
||||
|
@ -20,8 +18,26 @@
|
|||
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.']);
|
||||
return;
|
||||
}
|
||||
|
||||
if (room === 'hydro' && roomState.hydroDoorBroken) {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'The hyperlift moved, but to door to the hydro deck does not open.',
|
||||
'You can\'t access this deck with a broken door.'
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
muri.get('entity').get('lift.button'+i).sprite.playAnimation('on');
|
||||
var goMessage = r([
|
||||
var goMessage = muri.ra([
|
||||
'Sure, ' + room,
|
||||
'Okay, straight to ' + room,
|
||||
'Set ' + room + ' for destination',
|
||||
|
@ -54,11 +70,11 @@
|
|||
createButtonEntity(2, 'stasis'), // Stasis
|
||||
createButtonEntity(3, 'engine') // Engine room
|
||||
];
|
||||
buttons[1].sprite.playAnimation('on');
|
||||
buttons[2].sprite.playAnimation('on');
|
||||
};
|
||||
|
||||
lift.onEnter = function(fromRoom) {
|
||||
var welcomeMessage = r([
|
||||
var welcomeMessage = muri.ra([
|
||||
'Welcome on board, where do you want?',
|
||||
'Please specify your destination.',
|
||||
'Insert desired deck on console.',
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
if (!roomState.isLightOn) {
|
||||
muri.get('bubble')
|
||||
.story([
|
||||
[['Beep', 'Bip, Bip'], [20, 15]],
|
||||
[['Beep', 'Bip, Bip'], [17, 15]],
|
||||
[['Urgh ... ...', 'Where I am?', 'What happened?'], [40, 35]],
|
||||
[['I can\'t see a thing ...', '... need to turn on the light ...'], [40, 35]]
|
||||
])
|
||||
|
@ -52,8 +52,22 @@
|
|||
};
|
||||
|
||||
stasis.update = function() {
|
||||
if (roomState.isLightOn && !door)
|
||||
if (roomState.isLightOn && !door) {
|
||||
door = muri.door('stasis', [76, 11]);
|
||||
muri.get('entity')
|
||||
.create('stasis.capsule',
|
||||
kontra.sprite({x: 21, y: 21, width: 32, height: 8}))
|
||||
.addCallback(function() {
|
||||
muri.get('bubble')
|
||||
.talk([
|
||||
'That\'s my stasis capsule.',
|
||||
'It looks like the capsule itself is intact but had a malfunction.',
|
||||
'I am not an engineer, so I have noe idea whats wrong here ...'
|
||||
]);
|
||||
})
|
||||
.invisible = true;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
stasis.render = function() {
|
||||
|
|