-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.js
81 lines (80 loc) · 2.04 KB
/
database.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
var dbName = new Array();
var dbFunc = new Array();
function initDatabase()
{
dbName[dbName.length] = "dog";
dbFunc[dbFunc.length] = function(x, y)
{
dtemp = newCreature("dog");
dtemp.setSize(x, y, 0, 64, 32, 12);
dtemp.img = loadImage("dog.png");
dtemp.speed = 13;
dtemp.HP = dtemp.MaxHP = 7;
dtemp.addBlock(newBite());
dtemp.addBlock(newDog());
dtemp.ai = dumbAIAggressive;
dtemp.team = TEAM_DOGS;
return dtemp;
};
dbName[dbName.length] = "traveler";
dbFunc[dbFunc.length] = function(x, y)
{
dtemp = newCreature("traveler");
dtemp.setSize(x, y, 0, 64, 128, 32);
dtemp.img = loadImage("traveler.png");
dtemp.speed = 8;
dtemp.HP = dtemp.MaxHP = 13;
dtemp.addBlock(newKick());
dtemp.ai = dumbAIPeace;
dtemp.team = TEAM_PEOPLE;
return dtemp;
};
dbName[dbName.length] = "rock";
dbFunc[dbFunc.length] = function(x, y)
{
var dtemp = new GameObject("rock");
dtemp.setSize(x, y, 0, 64, 64, 32);
dtemp.img = loadImage("rock.png");
return(dtemp);
};
dbName[dbName.length] = "pond";
dbFunc[dbFunc.length] = function(x, y)
{
var dtemp = new GameObject("pond");
dtemp.setSize(x, y, 0, 128, 128, 128);
dtemp.img = loadImage("pond.png");
return(dtemp);
};
dbName[dbName.length] = "wallh";
dbFunc[dbFunc.length] = function(x, y)
{
var dtemp = new GameObject("wallh");
dtemp.setSize(x, y, 0, 77, 128, 32);
dtemp.img = loadImage("wall2.png");
return(dtemp);
};
dbName[dbName.length] = "wallv";
dbFunc[dbFunc.length] = function(x, y)
{
var dtemp = new GameObject("wallv");
dtemp.setSize(x, y, 0, 16, 173, 77);
dtemp.img = loadImage("wall.png");
return(dtemp);
};
dbName[dbName.length] = "palm";
dbFunc[dbFunc.length] = function(x, y)
{
var dtemp = new GameObject("palm");
dtemp.setSize(x, y, 0, 64, 128, 48);
dtemp.img = loadImage("palm.png");
return(dtemp);
};
}
function createObject(name, x, y)
{
for (var i = 0; i < dbName.length; i++)
{
if (dbName[i] == name) return dbFunc[i](x,y);
}
return null;
}