Jump to content

Pixel copy on image


Conrado
 Share

Recommended Posts

Hello there, thanks for reading. I was wondering if there is a way to copy the pixels from a loaded and displayed sprite/image to a new object, im trying to make a "Find the differences" game and i want to set the rectangle/square X,Y,X2,Y2 of a difference and then make a copy of the difference when you click it, so a new object with just the picture of the difference is created, so i can manipulate the difference itself. Thanks again!

 

Edit: im now using the bitMapData, and know how to copy the pixels, but how do i create a new object/sprite with this copied pixels? so i put it in a group

 

    this.bmd = game.make.bitmapData(800, 600);
    this.bmd.addToWorld();

    this.currentDifferences = new Phaser.Rectangle(100,350,150,250);
    this.bmd.copyRect(this.currentPicture, this.currentDifferences, 200, 100);

 

Link to comment
Share on other sites

  • 1 month later...
 Share

  • Recently Browsing   0 members

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