Jump to content

Get pixels of sprite and bake graphics object into sprite


Prolight
 Share

Recommended Posts

I just want to convert something like this:


// In create function
var graphics = this.add.graphics();

graphics.fillStyle(0x00605F, 1);
graphics.fillRectShape(new Phaser.Geom.Rectangle(0, 20, 470, 70));
graphics.fillRectShape(new Phaser.Geom.Rectangle(250, 0, 70, 200));


Into some type of sprite (then to a pixels array) or pixels array.

But how would I do that?

And how would I get the pixels of a sprite like this:

var player = this.add.existing(new Player(this, 300, 200, "player"));



(Why am I asking this? Well I want to create this: https://www.khanacademy.org/computer-programming/pixelated-collision-experiment/4899192330158080 in Phaser 3)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...