-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharmors.js
49 lines (45 loc) · 1.1 KB
/
armors.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
/**
* @author RCordeiro
*/
var helmetEntity = me.ObjectEntity.extend({
init: function(x, y, settings) {
// call the constructor
settings.type = "container";
//settings.image = "u6tiles";
settings.spritewidth = 16;
settings.spriteheight = 16;
this.parent(x, y, settings);
// set props
this.collidable = true;
this.status = "stand";
//animation
this.addAnimation("stand",[515]);
this.setCurrentAnimation("stand");
},
OnInteract: function(obj){
},
OnCollide: function(res,obj){
this.doBounce(res,obj);
},
doBounce: function(res,obj) {
if (res.x<0 && obj.vel.x<0){
obj.vel.x = 0;
};
if (res.x>0 && obj.vel.x>0){
obj.vel.x = 0;
}
if (res.y<0 && obj.vel.y<0){
obj.vel.y = 0;
};
if (res.y>0 && obj.vel.y>0){
obj.vel.y = 0;
}
},
update: function() {
return true;
},
draw: function (context)
{
this.parent(context);
},
});