Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var config = {
- type: Phaser.AUTO,
- width: 800,
- height: 600,
- backgroundColor: '#000000',
- parent: 'phaser-example',
- scene: {
- preload: preload,
- create: create,
- update: update
- }
- };
- var loopCount = 0, spr;
- var game = new Phaser.Game(config);
- function preload() {
- this.load.spritesheet('invader', 'assets/tests/invaders/invader3.png', { frameWidth: 48, frameHeight: 32 });
- }
- function create() {
- text = this.add.text(10, 10, '', { font: '16px Courier', fill: '#00ff00' });
- this.destr = []
- }
- function update() {
- if (this.destr.length)
- this.destr.forEach(s => s.destroy())
- loopCount++
- text.setText('LoopCount: ' + loopCount);
- for (var i = 0; i < 1000; i++) {
- this.destr.push(this.add.sprite(300, 300, 'invader'))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement