/
properties.js
37 lines (28 loc) · 963 Bytes
/
properties.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
class Example extends Phaser.Scene
{
create ()
{
const line = new Phaser.Geom.Line(100, 500, 700, 100);
const graphics = this.add.graphics({ lineStyle: { width: 4, color: 0xaa00aa } });
graphics.strokeLineShape(line);
graphics.lineStyle(2, 0x00aa00);
graphics.beginPath();
graphics.moveTo(line.left, line.top);
graphics.lineTo(line.right, line.top);
graphics.lineTo(line.right, line.bottom);
graphics.lineTo(line.left, line.bottom);
graphics.lineTo(line.left, line.top);
graphics.strokePath();
graphics.lineStyle(2, 0xaa0000);
graphics.lineBetween(line.x1, line.y1 + 10, line.x2, line.y1 + 10);
graphics.lineBetween(line.x1 - 10, line.y1, line.x1 - 10, line.y2);
}
}
const config = {
width: 800,
height: 600,
type: Phaser.AUTO,
parent: 'phaser-example',
scene: Example
};
const game = new Phaser.Game(config);