Fix feedback @moufmouf on circle texture
This commit is contained in:
parent
69777ad1cb
commit
68ac145882
@ -69,9 +69,11 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface, Creat
|
|||||||
console.warn("Don't know how to handle tileset ", tileset)
|
console.warn("Don't know how to handle tileset ", tileset)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//TODO strategy to add access token
|
||||||
this.load.image(tileset.name, `${this.MapUrlFile}/${tileset.image}`);
|
this.load.image(tileset.name, `${this.MapUrlFile}/${tileset.image}`);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
//TODO strategy to add access token
|
||||||
this.load.tilemapTiledJSON(this.MapKey, `${this.MapUrlFile}/${this.MapKey}.json`);
|
this.load.tilemapTiledJSON(this.MapKey, `${this.MapUrlFile}/${this.MapKey}.json`);
|
||||||
|
|
||||||
//add player png
|
//add player png
|
||||||
@ -139,18 +141,17 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface, Creat
|
|||||||
|
|
||||||
|
|
||||||
// Let's generate the circle for the group delimiter
|
// Let's generate the circle for the group delimiter
|
||||||
//TODO they are error with cercle
|
let circleElement = Object.values(this.textures.list).find((object: Texture) => object.key === 'circleSprite');
|
||||||
this.circleTexture = this.textures.createCanvas('circleSprite', 96, 96);
|
if(circleElement) {
|
||||||
if(!this.circleTexture || this.circleTexture.context){
|
this.textures.remove('circleSprite');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
this.circleTexture = this.textures.createCanvas('circleSprite', 96, 96);
|
||||||
let context = this.circleTexture.context;
|
let context = this.circleTexture.context;
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.arc(48, 48, 48, 0, 2 * Math.PI, false);
|
context.arc(48, 48, 48, 0, 2 * Math.PI, false);
|
||||||
// context.lineWidth = 5;
|
// context.lineWidth = 5;
|
||||||
context.strokeStyle = '#ffffff';
|
context.strokeStyle = '#ffffff';
|
||||||
context.stroke();
|
context.stroke();
|
||||||
|
|
||||||
this.circleTexture.refresh();
|
this.circleTexture.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +400,11 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface, Creat
|
|||||||
this.groups.get(groupId).setPosition(Math.round(groupPositionMessage.position.x), Math.round(groupPositionMessage.position.y));
|
this.groups.get(groupId).setPosition(Math.round(groupPositionMessage.position.x), Math.round(groupPositionMessage.position.y));
|
||||||
} else {
|
} else {
|
||||||
// TODO: circle radius should not be hard stored
|
// TODO: circle radius should not be hard stored
|
||||||
let sprite = new Sprite(this, Math.round(groupPositionMessage.position.x), Math.round(groupPositionMessage.position.y), 'circleSprite');
|
let sprite = new Sprite(
|
||||||
|
this,
|
||||||
|
Math.round(groupPositionMessage.position.x),
|
||||||
|
Math.round(groupPositionMessage.position.y),
|
||||||
|
'circleSprite');
|
||||||
sprite.setDisplayOrigin(48, 48);
|
sprite.setDisplayOrigin(48, 48);
|
||||||
this.add.existing(sprite);
|
this.add.existing(sprite);
|
||||||
this.groups.set(groupId, sprite);
|
this.groups.set(groupId, sprite);
|
||||||
|
Loading…
Reference in New Issue
Block a user