-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphaser.html
100 lines (76 loc) · 2.59 KB
/
phaser.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
</head>
<body>
<script>
var config = {
type: Phaser.AUTO,
width: 1280,
height: 720,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 0 }
}
},
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.setBaseURL('https://labs.phaser.io');
this.load.image('sky', 'assets/skies/space3.png');
this.load.image('logo', 'assets/sprites/phaser3-logo.png');
this.load.image('red', 'assets/particles/red.png');
//this.load.setBaseURL();
this.load.image('DK', 'https://ace510.github.io/assets/pink.png')
this.load.image('blue', 'https://ace510.github.io/assets/blue.png')
this.load.image('white', 'https://ace510.github.io/assets/white.png')
this.load.image('background', 'https://ace510.github.io//assets/background.png')
this.load.image('logo2', 'https://ace510.github.io/assets/logo.png')
}
function create ()
{
var graphics = this.add.graphics();
graphics.fillGradientStyle(0x5BCEFA, 0x5BCEFA, 0xF5A9B8, 0xF5A9B8, 1);
graphics.fillRect(0, 0, 1280, 360); // X Y Width Height
graphics.fillGradientStyle(0xF5A9B8, 0xF5A9B8, 0xFFFFFF, 0xFFFFFF, 1);
graphics.fillRect(0, 360, 1280, 360);
//this.add.image(640, 360, 'background');
var particles2 = this.add.particles('DK');
var particles = this.add.particles('blue');
var particles3 = this.add.particles('white');
var emitter = particles.createEmitter({
speed: 100,
scale: { start:1, end: 0.5 },
blendMode: 'ADD',
quantity: 1.0/3
});
var emitter2 = particles2.createEmitter({
speed: 100,
scale: { start:1, end: 0.5 },
blendMode: 'ADD',
quantity: 1.0/3
});
var emitter3 = particles3.createEmitter({
speed: 100,
scale: { start:1, end: 0.5 },
blendMode: 'ADD',
quantity: 1.0/3
});
var logo = this.physics.add.image(400,100, 'logo2');
logo.setVelocity(300, -200);
logo.setBounce(0.99, 0.99);
logo.setCollideWorldBounds(true);
emitter.startFollow(logo);
emitter2.startFollow(logo);
emitter3.startFollow(logo);
}
</script>
</body>
</html>