Jump to content

Search the Community

Showing results for tags 'phaser null'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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. var game = new Phaser.Game(400, 490, Phaser.AUTO, 'gamediv', { preload: preload, create: create, update: update });function preload() { // Change the background color of the game game.stage.backgroundColor = '#71c5cf'; // Load the bird sprite game.load.image('bird', 'assets/bird.png'); // Load the pipe sprite game.load.image('pipe', 'assets/pipe.png'); };function create() { // Fuction called after 'preload' to setup the game game.physics.startSystem(Phaser.Physics.ARCADE); // Display the bird on the screen bird = game.add.sprite(100, 245, 'bird'); game.physics.enable(bird, Phaser.Physics.ARCADE) // Add gravity to the bird to make it fall bird.body.gravity.y = 1000; // Call the 'jump' function when the spacekey is hit var space_key = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); space_key.onDown.add(jump, this); // Create multiple pipes pipes = game.add.group(); pipes.createMultiple(20, 'pipe'); pipes.enableBody = true; game.physics.enable(pipes, Phaser.Physics.ARCADE) // Timer and adds rows of pipes timer = game.time.events.loop(1500, add_row_of_pipes, this); // Adding key values. upKey = game.input.keyboard.addKey(Phaser.Keyboard.UP); downKey = game.input.keyboard.addKey(Phaser.Keyboard.DOWN); leftKey = game.input.keyboard.addKey(Phaser.Keyboard.LEFT); rightKey = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); bird.body.collideWorldBounds = true; score = 0; var style = { font: "30px Arial", fill: "#ffffff" }; label_score = game.add.text(20, 20, "0", style); game.physics.arcade.enable(bird);};function update() { if (leftKey.isDown) { bird.body.velocity.x = -350 } else if (rightKey.isDown) { bird.body.velocity.x = 350 } game.physics.arcade.collide(bird, pipes);};// Make the bird jump function jump() { // Add a vertical velocity to the bird bird.body.velocity.y = -350;};function add_one_pipe(x, y) { // Get the first dead pipe of our group var pipe = pipes.getFirstDead(); game.physics.enable(pipe, Phaser.Physics.ARCADE) // Set the new position of the pipe pipe.reset(x, y); // Add velocity to the pipe to make it move left pipe.body.velocity.y = -200; // Kill the pipe when it's no longer visible pipe.outOfBoundsKill = true;};function add_row_of_pipes() { var hole = Math.floor(Math.random()*5)+1; for (var i = 0; i < 8; i++) if (i != hole && i != hole +1) add_one_pipe(i*60+10, 500); score += 1; label_score.content = score; };Why do I get this error?
×
×
  • Create New...