Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
1,407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. var config = {
  2. type: Phaser.AUTO,
  3. width: 800,
  4. height: 600,
  5. backgroundColor: '#000000',
  6. parent: 'phaser-example',
  7. scene: {
  8. preload: preload,
  9. create: create,
  10. update: update
  11. }
  12. };
  13.  
  14. var loopCount = 0, spr;
  15.  
  16. var game = new Phaser.Game(config);
  17.  
  18. function preload() {
  19. this.load.spritesheet('invader', 'assets/tests/invaders/invader3.png', { frameWidth: 48, frameHeight: 32 });
  20. }
  21.  
  22. function create() {
  23.  
  24. text = this.add.text(10, 10, '', { font: '16px Courier', fill: '#00ff00' });
  25. this.destr = []
  26. }
  27.  
  28. function update() {
  29. if (this.destr.length)
  30. this.destr.forEach(s => s.destroy())
  31.  
  32. loopCount++
  33. text.setText('LoopCount: ' + loopCount);
  34. for (var i = 0; i < 1000; i++) {
  35. this.destr.push(this.add.sprite(300, 300, 'invader'))
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement