-
Notifications
You must be signed in to change notification settings - Fork 1
/
characters.ts
72 lines (68 loc) · 1.87 KB
/
characters.ts
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
namespace kodu {
export type CharacterDefn = {
id: string;
name: string;
weight: number; // Informs sorting in menus.
defaults: {
mass: number;
friction: number;
restitution: number; // bounciness
bumpCanMove: boolean;
speed: number;
}
};
export type CharacterMap = {
[id: string]: CharacterDefn;
};
export class Characters {
public static getCharacters(): CharacterDefn[] {
const chars = Object.keys(chardb.characters)
.map(id => chardb.characters[id])
.sort((a, b) => a.weight - b.weight);
return chars;
}
}
export type CharacterDatabase = {
characters: CharacterMap;
};
export const chardb: CharacterDatabase = {
characters: {
"kodu": {
id: "kodu",
name: "Kodu",
weight: 0,
defaults: {
mass: 5,
friction: 0.2,
restitution: 0.5,
bumpCanMove: true,
speed: 0.25,
}
},
"tree": {
id: "tree",
name: "Tree",
weight: 1,
defaults: {
mass: 100,
friction: 0.2,
restitution: 1,
bumpCanMove: false,
speed: 0.1,
}
},
"apple": {
id: "apple",
name: "Apple",
weight: 2,
defaults: {
mass: 1,
friction: 0.1,
restitution: 0.5,
bumpCanMove: true,
speed: 0.1,
}
},
}
};
}