-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
63 lines (53 loc) · 1.59 KB
/
main.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
class Main extends Player {
juice;
babyJuice;
constructor() {
super( 1200, 800, "Hello world", false );
this.scaleMode = ScaleMode.Pixel;
this.displayMode = DisplayMode.Contain;
this.letterboxColor = 0xff000000;
this.backgroundColor = 0xff662222;
this.juice = new display.Rive("juice.riv");
this.juice.scaleX = 0.6;
this.juice.scaleY = 0.6;
this.juice.originX = this.juice.width / 2;
this.juice.originY = this.juice.height / 2;
this.juice.x = this.stage.width / 2;
this.juice.y = this.stage.height / 2;
//this.juice.hitArea = new geom.HitAreaCircle(540,540,540);
this.stage.addChild( this.juice );
this.babyJuice = new display.Rive( "juice.riv" );
this.babyJuice.originX = this.babyJuice.width / 2;
this.babyJuice.originY = this.babyJuice.height / 2;
this.babyJuice.x = this.juice.width;
this.babyJuice.y = 0;
this.babyJuice.scaleX = 0.3;
this.babyJuice.scaleY = 0.3;
this.juice.addChild( this.babyJuice );
console.log('About to listen');
this.juice.listen( MouseEventType.Down, this.onMouseClick );
this.stage.listen( PlayerEventType.Update, this.onUpdate );
console.log('Done listening');
console.log("Constructed");
}
onUpdate( t ) {
console.log("onUpdate", t);
//juice.rotation += event.dt * 20;
//babyJuice.rotation += event.dt * 40;
return true;
}
onMouseClick( t ) {
console.log("onMouseClick", t);
//babyJuice.x = juice.mouse.x;
//babyJuice.y = juice.mouse.y;
return false;
}
}
function _onUpdate( event ) {
console.log('_onUpdate');
}
function _onMouseClick( event ) {
console.log('_onMouseClick');
}
main = new Main();
main.run();