I am using this.game.renderer.snapshotArea to get an area of the game screen. I pass the context “this” to have it inside the function callback, but it does not work:
this.game.renderer.snapshotArea(xt, yt, 10*tam, 10*tam, function(image){
if (this.textures.exists('area')){
this.textures.remove('area');
}
this.textures.addImage('area', image);
for(var yy=0; yy<10; yy++){
for(var xx=0; xx<10; xx++){
console.log(this.textures.getPixel(xx*tam, yy*tam, 'area'));
}
}
}, this);
I can solve it using a var to get the context before the callback, but I think it is better to fix it.
(I can not explain better, sorry for my English)