Kraken

Members
  • Content count

    28
  • Joined

  • Last visited

About Kraken

  • Rank
    Member

Recent Profile Visitors

149 profile views
  1. Ah yes I should of put in a world bounds so you cant just skip all the pipes. That is a smart move on your part though.
  2. I did learn quite a bit from this one. I originally had a bird that was flapping its wings but I didn't have a sprite sheet for the fish but I am planning on putting in a sound and a sprite sheet for the player.
  3. Thanks for trying it out! I guess it may a bit hard but I used to play the original Flappy Bird for hours so I thought it was easy when i made this one.
  4. OK so should I put the code of the game inside the IIFE? I'm fairly new to JS and I'm not sure how this would protect the code on the client.
  5. Hey Arcanorum, I guess once the files are on the web they are not really safe anymore. Do you recommend JSCompress?
  6. Thanks JohnCitron, do you recommend I use something like JScrambler to encrypt the game?
  7. I didn't even know about circle physics bodies. Thanks Arcanorum! I contemplated using a timer but I wanted to keep the bubble effect and make the player hit an urchin to shrink back.
  8. Here is my second try at a phaser game. I based it on the flappy bird tutorial. Let me know what you think I could do to improve it. https://kraken18.github.io/flappyboard/
  9. Awesome, I'm gonna have a look around those sites
  10. I'm pretty new to phaser and JS and I'm wondering if anyone knows where to get good graphics. Possibly custom graphics if possible.
  11. This did the trick thanks alot Samme!
  12. Yes I noticed that as well but you're right it did not fix the issue
  13. if(this.x+this.width < this.bird.x && this.giveScore){
  14. I'm trying to make a flappy bird game and I'm getting an error Uncaught TypeError: Cannot read property 'x' of undefined Game.js:76 I'm not sure if its the constructor or something else giving me this error...I have attached the code for reference var FlappyBoard = FlappyBoard || {}; FlappyBoard.GameState = { init: function() { // bird gravity, will make bird fall if you don't flap this.birdGravity = 800; // horizontal bird speed this.birdSpeed = 125; // flap thrust this.birdFlapPower = 300; // milliseconds between the creation of two pipes this.pipeInterval = 2000; // hole between pipes, in puxels this.pipeHole = 120; this.score=0; this.pipeGroup = this.add.group(); }, create:function(){ this.topScore = localStorage.getItem("topFlappyScore")==null?0:localStorage.getItem("topFlappyScore"); scoreText = this.add.text(10,10,"-",{ font:"bold 16px Arial" }); this.updateScore(); this.stage.backgroundColor = "#87CEEB"; this.stage.disableVisibilityChange = true; //game.physics.startSystem(Phaser.Physics.ARCADE); this.bird = this.add.sprite(80,240,'bird'); this.bird.anchor.set(0.5); this.game.physics.arcade.enable(this.bird); this.bird.body.gravity.y = this.birdGravity; this.game.input.onDown.add(this.flap, this); this.game.time.events.loop(this.pipeInterval, this.addPipe); this.addPipe(); }, update:function(){ this.game.physics.arcade.collide(this.bird, this.pipeGroup, this.die, null, this); }, //this.game.state.start('GameState'); updateScore: function(){ scoreText.text = "Score: "+this.score+"\nBest: "+this.topScore; }, flap: function(){ this.bird.body.velocity.y = -this.birdFlapPower; }, addPipe: function(){ var pipeHolePosition = this.rnd.between(50,430-this.pipeHole); var upperPipe = new FlappyBoard.Pipe(this.game,320,pipeHolePosition-480,-this.birdSpeed, 'pipe'); this.game.add.existing(upperPipe); this.pipeGroup.add(upperPipe); var lowerPipe = new FlappyBoard.Pipe(this.game,320,pipeHolePosition+this.pipeHole,-this.birdSpeed); this.game.add.existing(lowerPipe); this.pipeGroup.add(lowerPipe); }, die: function(){ localStorage.setItem("topFlappyScore",Math.max(this.score,topScore)); } }; FlappyBoard.Pipe = function (game, x, y, speed) { Phaser.Sprite.call(this, game, x, y, 'pipe'); game.physics.enable(this, Phaser.Physics.ARCADE); this.body.velocity.x = speed; this.giveScore = true; }; FlappyBoard.Pipe.prototype = Object.create(Phaser.Sprite.prototype); FlappyBoard.Pipe.prototype.constructor = FlappyBoard.Pipe; FlappyBoard.Pipe.prototype.update = function() { if(this.x+this.width < this.bird.x && this.giveScore){ this.score+=0.5; this.updateScore(); this.giveScore = false; } if(this.x<-this.width){ this.destroy(); } };
  15. Hi Pheaset, thanks for trying it out. I'm not sure why the game.html doesn't work for you but either way it should be on either URL. I used the infinite runner tutorial from the Zenva Academy.