-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverworldMap.js
64 lines (61 loc) · 1.34 KB
/
OverworldMap.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
//
class OverworldMap {
constructor(config) {
// Array of Game Objects
this.gameObjects = config.gameObjects;
// Bottom Image
this.lowerImage = new Image();
this.lowerImage.src = config.lowerSrc;
// Top Image
this.upperImage = new Image();
this.upperImage.src = config.upperSrc;
}
drawLowerImage(ctx) {
ctx.drawImage(this.lowerImage, 0, 0);
}
drawUpperImage(ctx) {
ctx.drawImage(this.upperImage, 0, 0);
}
}
window.OverworldMaps = {
DemoRoom: {
lowerSrc: "/images/maps/DemoLower.png",
upperSrc: "/images/maps/DemoUpper.png",
gameObjects: {
hero: new GameObject({
x: 5,
y: 6,
}),
npcA: new GameObject({
x: 7,
y: 9,
src: "/images/characters/people/npc1.png",
}),
npcB: new GameObject({
x: 6,
y: 7,
src: "/images/characters/people/npc2.png",
}),
},
},
Kitchen: {
lowerSrc: "/images/maps/KitchenLower.png",
upperSrc: "/images/maps/KitchenUpper.png",
gameObjects: {
hero: new GameObject({
x: 3,
y: 5,
}),
npcA: new GameObject({
x: 9,
y: 6,
src: "/images/characters/people/npc1.png",
}),
npcB: new GameObject({
x: 10,
y: 8,
src: "/images/characters/people/npc2.png",
}),
},
},
};