Search the Community

Showing results for tags 'initialize'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi. I have a big problem with my Phaser project. I use Phaser + Typescript. I use this tutorial: http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-1/ If I use the following code, I get this error: "Uncaught TypeError: Cannot set property 'gravity' of null" class FlappyBirdsGame { game: Phaser.Game; bird; constructor(renderDiv: String) { this.game = new Phaser.Game(400, 490, Phaser.AUTO, renderDiv, { preload: this.preload, create: this.create, update: this.update }); this.game.state.add('main', this); } preload() { this.game.stage.backgroundColor = '#71c5cf'; this.game.load.image('bird', 'assets/bird.png'); } create() { this.bird = this.game.add.sprite(100, 245, 'bird'); this.bird.body.gravity = 1000; var spaceKey = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); spaceKey.onDown.add(this.jump, this); } update() { if (this.bird.inWorld == false) { this.restartGame(); } } jump() { this.bird.body.velocity.y = -350; } restartGame() { this.game.state.start('main'); }}window.onload = () => { var game = new FlappyBirdsGame('content');}What is the problem? If I run this code, the "bird" is displayed. You can see the source also on git: https://github.com/ppfeiler/FlappyBirdClon Thank you