-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPorte3.js
45 lines (40 loc) · 992 Bytes
/
Porte3.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
class Porte3 extends Phaser.GameObjects.Sprite
{
constructor(scene,key,x,y)
{
super(scene,x,y,"door3");
scene.add.existing(this);
scene.physics.world.enableBody(this);
//
this.body.immovable=true;
this.body.collideWorldBounds=true;
this.key = key;
this.body.allowGravity = false;
this.body.setSize(80,160);
}
DoorOpen(collide,collide2)
{
if( keyNumber3 == this.key)
{
collide.active = false;
collide2.active = false;
this.setAlpha(0);
}
if(player.y <= SwitchY && player.x <=SwitchX)
{
this.destroy();
}
if(player.y >= SwitchY2 && player.x <=SwitchX2)
{
this.destroy();
}
}
Reset(collide,collide2)
{
collide.active = true;
collide2.active = true;
this.setAlpha(1);
restartDoor3 = 0;
keyNumber3 = 0;
}
}