-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
68 lines (66 loc) · 1.67 KB
/
sketch.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function preload() {
loadAssets();
}
function setup() {
createCanvas(screenWidth, screenHeight);
frameRate(frameRateNumber);
noSmooth();
noStroke();
runMap("map1");
console.clear()
console.log('%c<----Game Successfully Started---->', 'color:rgb(255, 0, 0)')
}
function draw() {
textFont(mainFont);
changeEngine();
animations()
switch (currentEngine) {
case ENGINE_ONE:
engineOneStart();
break;
case ENGINE_TWO:
engineTwoStart();
break;
case MENU:
menuStart();
break;
default:
throw new Error(`Engine named : ${currentEngine} not found !`);
}
if (canShowInventoryAnimation) {
addToInventory(newObjectToAdd);
setTimeout(() => {
if (!objectAsBeenAdToInventoryWithAnimation) {
canShowInventoryAnimation = false;
inventoryTab[inventoryTabNumber] = newObjectToAdd;
inventoryTabNumber++;
objectAsBeenAdToInventoryWithAnimation = true;
canChangeObjectInventory = false;
canShowObjectInAnimation = true;
newObjectSize = 128;
newObjectOldX = 0;
newObjectOldY = 0;
canUpObjectSize = true;
return;
}
}, 8000);
}
if (canDoTransition) {
noStroke();
fill(0, 0, 0, fade);
rect(0, 0, screenWidth, screenHeight);
if (transitionStatus === "Enter") {
transitionEnter();
}
if (transitionStatus === "Out" && !animationActeTwoStart) {
currentEngine = newEngineSelected;
introductionIllustration.stop()
canPlayIntroduction = false;
transitionOut();
}
}
if (canInteract && !canMovePlayer && animationActeTwoStart) {
writeText(actualDialog);
noFill();
}
}