-
Notifications
You must be signed in to change notification settings - Fork 6
/
ExportedGameInitializer.js
34 lines (33 loc) · 1.52 KB
/
ExportedGameInitializer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class ExportedGameInitializer {
static initializeExportedGame(allData) {
WorldDataHandler.levels = allData.levels;
WorldDataHandler.gamesName = allData.gamesName;
WorldDataHandler.endingMessage = allData.endingMessage;
WorldDataHandler.effects = allData.effects;
WorldDataHandler.backgroundColor = allData.backgroundColor;
WorldDataHandler.textColor = allData.textColor;
TransitionAnimationHandler.animationFrames = allData.animationFrames;
TransitionAnimationHandler.animationType = allData.animationType;
if(allData?.sounds) {
allData.sounds.forEach(sound => {
if(sound.type === 'music' && !SoundHandler.doesSoundExist(sound.key)) {
SoundHandler.sounds.push({
key: sound.key, descriptiveName: "", value: sound.value, type: "music", customValue: true,
});
SoundHandler[sound.key] = new Sound(sound.value, sound.key, true);
}
SoundHandler.reloadSound(sound.key, sound.value);
})
}
for (const [key, value] of Object.entries(allData.playerObject)) {
player[key] = value;
}
for (const [key, value] of Object.entries(allData.sprites)) {
if (key !== "TELEPORT" && key !== "TELEPORT2" && key !== "SFX4") {
SpritePixelArrays[key] = value;
}
}
player.setAnimationProperties();
SpritePixelArrays.fillAllSprites();
}
}