-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scene1.js
42 lines (40 loc) · 1.03 KB
/
Scene1.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
class Scene1 extends Phaser.Scene {
constructor() {
super({ key: 'scene1' });
}
preload() {
this.load.image('kenny', './kennyBlue.png')
}
create() {
// creating a object with the width 20 pixels larger than the canvas
// notice the right side cropping
this.add.nineslice(
-10,
10,
this.cameras.main.width + 20,
100,
'kenny',
[35, 15, 15]
);
// creating a object 10px larger than the width but scaling 0.5
// notice the right side cropping
this.add.nineslice(
150,
150,
this.cameras.main.width + 10,
100,
'kenny',
[35, 15, 15]
).setScale(0.5);
// creating a normal object for comparison
this.add.nineslice(
150,
300,
100,
100,
'kenny',
[35, 15, 15]
)
// the cropping issue occours on height too
}
}