-
Notifications
You must be signed in to change notification settings - Fork 4
/
Door.js
34 lines (25 loc) · 941 Bytes
/
Door.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
var Door = me.ObjectEntity.extend({
init: function( x, y, settings )
{
settings = settings || {};
settings.image = settings.image || me.loader.getImage( settings.width > settings.height ? "hdoor" : "vdoor" );
settings.spritewidth = settings.width > settings.height ? 192 : 96;
settings.spriteheight = settings.width > settings.height ? 96 : 192;
console.log ( settings.width, settings.height );
if( ! settings.require ) {
throw "Must set required count on door";
}
this.parent( x, y, settings );
this.addAnimation( "play", [ 0, 1, 2 ] );
this.setCurrentAnimation( "play" );
this.door = 1;
this.gravity = 0;
this.require = settings.require;
this.collidable = true;
me.state.current().doors.push(this);
},
update: function()
{
return this.parent( this );
}
});