Jump to content

Search the Community

Showing results for tags 'update loop'.

  • 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. Hello, I'm creating, a player object with different states, e.g: onground, inair, etc I'm trying to assign a method to this.currentState. In the update loop, i'm calling this.currentState to run the assigned method (this.groundState), However, i'm receiving the following error 'this.currentState is not a function' SuperSmash.Player = function(game, x, y) { Phaser.Sprite.call(this, game, x, y, 'player'); this.game.physics.arcade.enable(this); this.speed = 500; this.airSpeed = 300; this.jumpPower = 400; this.inAir = true; this.hitGround = false; this.body.gravity.y = 1350; this.currentState = this.groundState; console.log(this.currentState); // undefined }; SuperSmash.Player.prototype = Object.create(Phaser.Sprite.prototype); SuperSmash.Player.prototype.constructor = SuperSmash.Player; SuperSmash.Player.prototype.update = function() { this.currentState(); }; SuperSmash.Player.prototype.groundState = function() { console.log('ground'); } };
×
×
  • Create New...