Work on the actual game haha

This commit is contained in:
Aaron Fischer 2017-09-12 23:52:00 +02:00
parent c18d9221f9
commit 48a0bee23f
14 changed files with 77 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 104 B

View file

@ -16,7 +16,7 @@
var parts = text.split(' '); var parts = text.split(' ');
var showFragment = function() { var showFragment = function() {
if (parts.length === 0) { if (parts.length === 0) {
delayTimer = setTimeout(resolve, 3000); delayTimer = setTimeout(resolve, 1500);
return; return;
} }
dom.innerHTML += parts.shift() + ' '; dom.innerHTML += parts.shift() + ' ';

View file

@ -19,7 +19,8 @@
addCallback: function(callback) { addCallback: function(callback) {
this.callbacks.push(callback); this.callbacks.push(callback);
return this; return this;
} },
invisible: false
}; };
allEntities.push(e); allEntities.push(e);
return e; return e;
@ -44,7 +45,7 @@
entity.render = function() { entity.render = function() {
allEntities.forEach(function(e) { allEntities.forEach(function(e) {
if (e.name.split('.')[0] === muri.currentRoom) if (e.name.split('.')[0] === muri.currentRoom && !e.invisible)
e.sprite.render(); e.sprite.render();
}); });
}; };

View file

@ -45,6 +45,10 @@ var muri = (function() {
var muri = {}; var muri = {};
muri.ra = function(a) {
return a[Math.floor(Math.random()*a.length)];
};
muri.bg = function(room) { muri.bg = function(room) {
return kontra.sprite({ return kontra.sprite({
x: 0, y: 0, x: 0, y: 0,

View file

@ -5,6 +5,24 @@
var background, door = null; var background, door = null;
var roomState = { 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() { engine.init = function() {
@ -14,6 +32,18 @@
engine.onEnter = function() { engine.onEnter = function() {
door.sprite.playAnimation('close'); 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() { engine.update = function() {

View file

@ -6,12 +6,10 @@
var buttonSheet, background = null; var buttonSheet, background = null;
var buttons = []; var buttons = [];
var roomState = { 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 createButtonEntity = function(i, room) {
var e = muri.get('entity') var e = muri.get('entity')
@ -20,8 +18,26 @@
animations: buttonSheet.animations})) animations: buttonSheet.animations}))
.addCallback(function() { .addCallback(function() {
buttons.forEach(function(b) { b.sprite.playAnimation('off'); }); 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'); muri.get('entity').get('lift.button'+i).sprite.playAnimation('on');
var goMessage = r([ var goMessage = muri.ra([
'Sure, ' + room, 'Sure, ' + room,
'Okay, straight to ' + room, 'Okay, straight to ' + room,
'Set ' + room + ' for destination', 'Set ' + room + ' for destination',
@ -54,11 +70,11 @@
createButtonEntity(2, 'stasis'), // Stasis createButtonEntity(2, 'stasis'), // Stasis
createButtonEntity(3, 'engine') // Engine room createButtonEntity(3, 'engine') // Engine room
]; ];
buttons[1].sprite.playAnimation('on'); buttons[2].sprite.playAnimation('on');
}; };
lift.onEnter = function(fromRoom) { lift.onEnter = function(fromRoom) {
var welcomeMessage = r([ var welcomeMessage = muri.ra([
'Welcome on board, where do you want?', 'Welcome on board, where do you want?',
'Please specify your destination.', 'Please specify your destination.',
'Insert desired deck on console.', 'Insert desired deck on console.',

View file

@ -37,7 +37,7 @@
if (!roomState.isLightOn) { if (!roomState.isLightOn) {
muri.get('bubble') muri.get('bubble')
.story([ .story([
[['Beep', 'Bip, Bip'], [20, 15]], [['Beep', 'Bip, Bip'], [17, 15]],
[['Urgh ... ...', 'Where I am?', 'What happened?'], [40, 35]], [['Urgh ... ...', 'Where I am?', 'What happened?'], [40, 35]],
[['I can\'t see a thing ...', '... need to turn on the light ...'], [40, 35]] [['I can\'t see a thing ...', '... need to turn on the light ...'], [40, 35]]
]) ])
@ -52,8 +52,22 @@
}; };
stasis.update = function() { stasis.update = function() {
if (roomState.isLightOn && !door) if (roomState.isLightOn && !door) {
door = muri.door('stasis', [76, 11]); 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() { stasis.render = function() {