Skip to content

Commit b9fe695

Browse files
allowed removing game Characters
1 parent a485fda commit b9fe695

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

behavior/game.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Standards.game.updateScaling = function (x, y) {
352352
Standards.game.setDisplayDimensions(x, y);
353353
});
354354
}
355-
} else if (Standards.game.getType(candidate) = "HTMLElement") {
355+
} else if (Standards.game.getType(candidate) = "HTMLElement") { //// something can be wrong here even after onLoad
356356
container = candidate;
357357
let x = Number(window.getComputedStyle(container).width.slice(0, -2));
358358
let y = Number(window.getComputedStyle(container).height.slice(0, -2));
@@ -1409,6 +1409,20 @@ Standards.game.Character = function (source, options) {
14091409
});
14101410
};
14111411

1412+
this.removeBody = function () {
1413+
/**
1414+
removes the character's body
1415+
*/
1416+
character.body.parentNode.removeChild(character.body);
1417+
}
1418+
this.ceaseToExist = function () {
1419+
/**
1420+
removes the character from the game
1421+
*/
1422+
character.removeBody();
1423+
Standards.game.Character.instances.splice(Standards.game.Character.instances.indexOf(character), 1);
1424+
}
1425+
14121426
Standards.game.Character.instances.push(this);
14131427
};
14141428
Standards.game.Character.instances = [];

behavior/general.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,10 +982,12 @@ Standards.general.Speaker = function (specs) {
982982
return new Promise(function (resolve) {
983983
if (time == 0) {
984984
talker.cancel();
985+
speaker.speaking = false;
985986
resolve();
986987
} else {
987988
setTimeout(function () {
988989
talker.cancel();
990+
speaker.speaking = false;
989991
resolve();
990992
}, time);
991993
}

0 commit comments

Comments
 (0)