Jump to content

Search the Community

Showing results for tags 'wip platform game'.

  • 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. I have a healthBar entity given by the code below which is in a separate file called health_bar_entity.js(melonjs code base) game.HealthBar = me.Renderable.extend( { init: function(hitPoints, maxHitPoints) { this._super(me.Renderable, "init", [0, -24, 48, 6]); this.z = 100; this.hitPoints = hitPoints; this.maxHitPoints = maxHitPoints; this.health = 1; this.currentHealth = 1; this.setHealth(hitPoints); this.borderColor = '#000'; this.alwaysUpdate = false; }, draw : function(renderer) { if(this.health>=0) { renderer.setColor(this.borderColor); renderer.fillRect(this.pos.x, this.pos.y, this.width, this.height); renderer.setColor('#F00'); renderer.fillRect(this.pos.x+1, this.pos.y+1, this.width-2, this.height-2); renderer.setColor('#0F0'); if(this.health>1) renderer.fillRect(this.pos.x+1, this.pos.y+1, this.width-2, this.height-2); else renderer.fillRect(this.pos.x+1, this.pos.y+1, (this.width-2)*this.health, this.height-2); } }, update : function() { if(this.updateOnce) { this.updateOnce = false; return true; } if(this.health==this.currentHealth) return false; this.health = this.currentHealth; return true; }, setHealth: function(hitPoints) { this.currentHealth = hitPoints/this.maxHitPoints; }, setCurrentAnimation: function() { //do nothing }, setAnimationFrame: function(blarg) { //do nothing } }); and I want to add this to the player entity, but when I try to add to the player by using the code below, this is in the file game_player_entity.js(melonjs code base) this.player_health = 50; this.player_max_health = 100; this.healthBar = me.pool.pull("playerHealthbar", this.player_health, this.player_max_health); console.log('health bar' + this.healthBar); this.addChild(this.healthbar, 9); it give me an error don't know whats going wrong have looked at the api and it seems that it should work
×
×
  • Create New...