forked from abhijitWakchaure/akatsuki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassenger.js
30 lines (29 loc) · 832 Bytes
/
passenger.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
class Passenger {
constructor(id, x, y, w, h, d) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.body = Bodies.rectangle(x, y, w, h, {
render: {
sprite: {
texture: 'images/p' + max(1, id % 9) + '.png',
xScale: 0.375,
yScale: 0.375,
}
}
});
this.body.passengerId = id;
this.body.label = 'passenger' + id;
this.body.patience = 100;
this.body.isInsideCar = false;
this.body.destination = d;
this.body.hide = function () {
this.render.visible = false;
}
this.body.remove = function () {
World.remove(world, this)
}
Composite.add(world, this.body);
}
}