Closed edgarjcfn closed 9 years ago
Excellent, simple fixes too - thanks a lot!
This is Amazing :dancer:
I will take a look at padding out this d.ts file this weekend, most of it was done when I noticed the original problem.
Thanks! It was killing me.
Hi, I'm new to typescript/Phaser and I'm trying to convert the example from the website "Pointer interaction" to typescript but I'm blocking on how to replace game.iso by projector and game.add.isoSprite by addIsoSrpite.
My preload look like this :
preload() {
this.game.plugins.add(Phaser.Plugin.Isometric);
this.game.iso.anchor.setTo(0.5, 0.2);
}
and spawnTiles :
spawnTiles() {
var tile;
for (var xx = 0; xx < 256; xx += 38) {
for (var yy = 0; yy < 256; yy += 38) {
tile = this.game.add.isoSprite(xx, yy, 0, 'tile', 0, this.isoGroup);
tile.anchor.set(0.5, 0);
}
}
}
As explained on this Thread the approach of extending the behaviour of Phaser's core classes by adding methods and properties to them, makes the game incompatible with Typescript. That's because it's not possible in Typescript to merge class definitions.
This pull request solves this problem by adding references that are not extending Phaser's core classes. More specifically
projector
where it was before accessed bygame.iso
addIsoSprite()
where it was before accessed bygame.add.isoSprite
The other important addition is the inclusion of
phaser.plugin.isometric.d.ts
file with Typescript Definitions. It's still not complete, but should be enough to run the examples on the website.