-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglobal.js
161 lines (141 loc) · 2.41 KB
/
global.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
* GLOBAL DECLARATIONS
*/
// Constants
const WIDTH = 800;
const HEIGHT = 600;
const MOVE_SPEED = 4;
const ANIM_SPEED = 0.08;
const TILE_SIZE = 64;
const NUM_OF_MINI_GAMES = 1;
const KEY_LEFT = 37;
const KEY_RIGHT = 39;
const KEY_UP = 38;
const KEY_DOWN = 40;
const ACTION_KEY = 32;
const QUEST_KEY = 81;
const INVENTORY_KEY = 73;
const MENU_KEY = 77;
//label global variables
//Game declarations
let g,
thingsToLoad,
world,
outside_world,
building_world,
camera;
//sprites (objects from world)
let player,
player_tex,
thomas,
patrick,
pepe,
rebecca,
elie,
seth,
snowy,
redherring,
gloves,
doors;
//map arrays
let wallMapArray,
npcArray,
doorMapArray,
itemLayerArray;
let playerVsItem;
//keycodes
let leftArrow,
upArrow,
downArrow,
rightArrow,
interact,
questkey,
menukey,
inventorykey;
//dialogue
let thomasDiag,
miaDiag,
snowyDialog,
patrickDialog,
sethDialog,
rebeccaDialog,
elieDialog,
pepeDialog;
//objects made from classes
let npcThomas,
npcPatrck,
npcPepe,
npcRebecca,
npcElie,
npcSeth,
npcSnowy,
itemGloves,
itemRedHerring,
itemFlowers,
itemPerfume,
itemBroom,
itemWand,
quest1,
quest2,
quest3;
//sounds
let sfxStep,
sfxBloop,
sfxClose,
sfxGibberish,
sfxLose,
sfxPop,
sfxWin;
//object arrays
let questArray = [];
let allQuestsArray = [];
let questNPCArray = [];
let regNPCArray = [];
let questTextArray = [];
let itemArray = [];
let inventory = [];
let worldTriggerArray = [];
let buildingTriggerArray = [];
//let dialogueArray = [];
let gameScene,
dialogueScene,
menuScene,
questListScene,
titleScene,
gameOverScene,
inventoryScene,
howToPlayScene,
creditsScene;
//text variables
let menuText,
questListText,
cancelText,
emptyQuestText,
exitText,
dialogueText,
npcNameText,
titleText,
playText,
gameOverText,
inventoryText,
startOverText,
creditsText,
howToPlayText,
credits,
instructions,
eliename,
rebeccaname,
sethname;
let playerVsFloor,
playerVsNPC,
playerVsTrigger;
let backgroundRect,
backgroundRect2; //= g.rectangle(300, 300, "green");
let counter = 0; //temporary counter for displaying quests
let alreadyDisplayed = false; //temporary bool to display quests
let sceneState = false;
//stuff I couldn't find in code (delete if not needed)
let items, //
message,//
quests,
npcs; //