Indenialgamer

Members
  • Content Count

    7
  • Joined

  • Last visited

  1. Hi All, Are there any examples of a leader board built with phaser and firebase? I essentially just want to create a leaderboard to record the score of a user and they can input there name aswell, i have looked into firebase but its not making any sense to me. Thanks
  2. unfortunately this did not work. Thanks for your help regardless
  3. Hi I have an issue in my game.js these are snippets from the entire code where bullets and enemies overlap, but when they overlap the game crashes?: create : function(){ this.enemies = game.add.group(); this.enemies.enableBody = true; for (var i = 0; i < 1; i++) { var s = this.enemies.create(game.world.randomX, game.world.randomY, 'enemy1'); s.name = 'enemy1' + s; s.body.collideWorldBounds = true; s.body.bounce.setTo(0.1, 0.1); s.animations.add('walk', [0, 1,]); s.play('walk', 6, true); s.body.velocity.setTo(5 + Math.random() * 40, 5 + Math.random() * 40); } { var f = this.enemies.create(game.world.randomX, game.world.randomY, 'enemy2'); f.name= 'enemy2' + f; f.body.collideWorldBounds = true; f.body.bounce.setTo(0.1, 0.1); f.animations.add('walk', [0, 1,]); f.play('walk', 6, true); f.body.velocity.setTo(5 + Math.random() * 40, 5 + Math.random() * 40); } } update: function() { game.physics.arcade.overlap(this.bullet, this.enemies, this.enemyKill, null, this); enemyKill: function(){ this.enemies.kill(); this.score += 10; this.scoreText.text = 'score: ' + score; }, Thanks
  4. so i have another example where it does not work these are snippets from the entire code in my game.js where bullets and enemies overlap, but when they overlap the game crashes?: create : function(){ this.enemies = game.add.group(); this.enemies.enableBody = true; for (var i = 0; i < 1; i++) { var s = this.enemies.create(game.world.randomX, game.world.randomY, 'enemy1'); s.name = 'enemy1' + s; s.body.collideWorldBounds = true; s.body.bounce.setTo(0.1, 0.1); s.animations.add('walk', [0, 1,]); s.play('walk', 6, true); s.body.velocity.setTo(5 + Math.random() * 40, 5 + Math.random() * 40); } { var f = this.enemies.create(game.world.randomX, game.world.randomY, 'enemy2'); f.name= 'enemy2' + f; f.body.collideWorldBounds = true; f.body.bounce.setTo(0.1, 0.1); f.animations.add('walk', [0, 1,]); f.play('walk', 6, true); f.body.velocity.setTo(5 + Math.random() * 40, 5 + Math.random() * 40); } } update: function() { game.physics.arcade.overlap(this.bullet, this.enemies, this.enemyKill, null, this); enemyKill: function(){ this.enemies.kill(); this.score += 10; this.scoreText.text = 'score: ' + score; }, thanks again
  5. Hi Thanks for your continuing help on this topic i appreciate it. the issue im having is not understanding the structure of the phases but not understanding why when i try to add in my game code to the game state it simply is different then what the tutorials read. For example this was my original code when i was writing the game directly into the index html body as there was one state: function fireBullet () { if (game.time.now > bulletTime) { bullet = bullets.getFirstExists(false); if (bullet) { bullet.reset(player.x + 20, player.y - 40); bullet.body.velocity.y = -700; bulletTime = game.time.now + 150; } But now when i try to add it along with the rest of the code into the game.js it simply does not work. Im so confused. Sorry and thanks
  6. Hi Thanks for the example! basically i have this code which i wrote to fire bullets but i writ it on the index page before i started using states and it was working fine, as soon as i have tried to implement into js for a state it does not work. Code : function fireBullet () { if (game.time.now > bulletTime) { bullet = bullets.getFirstExists(false); if (bullet) { bullet.reset(player.x + 20, player.y - 40); bullet.body.velocity.y = -700; bulletTime = game.time.now + 150; }
  7. Hi All i was wondering if someone could help me with a phaser state query. I have been learning phaser from phaser.io and its all for a html index file however the code seems to be different then to what i need if i was to build a game with states. For example i have a player walking animation but converting it for js states seems to be very difficult, i cannot find a tutorial anywhere. Any chance someone could point me in the right direction? happy to share the code Thanks