Jump to content

Search the Community

Showing results for tags 'pain'.

  • 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. Hi guys, Could anyone kindly shows me a little bit of code about pick and paint color to the sprite? here is my code that I have played around, but I still cannot find out and achieve it. Thanks you in advance for your time and consideration. preload: function() { this.game.load.image('test', 'test.png'); }, create: function() { this.color1 = this.drawRec('rgb(141,243,160)', 20, 20); this.color2 = this.drawRec('#6bd4e0', 100, 20); this.color3 = this.drawRec('#cb6be0', 20, 100); this.color4 = this.drawRec('#8df3a0', 100, 100); this.square = this.game.make.bitmapData(); this.square.load('test'); this.square.addToWorld(this.game.world.centerX, this.game.world.centerY, 0.5, 0.5); this.game.input.onDown.add(this.pickColor, this); }, drawRec: function(color, x, y) { this.bmd = this.game.make.bitmapData(100, 100); this.bmd.ctx.beginPath(); this.bmd.ctx.rect(0,0,50,50); this.bmd.ctx.fillStyle = color; this.bmd.ctx.fill(); this.sprite = this.game.add.sprite(x, y, this.bmd); }, pickColor: function(pointer, x, y) { console.log(this.bmd.getPixelRGB(x,y)); }
×
×
  • Create New...