Merge pull request #357 from thecodingmachine/fix-red-circle
Fix red circle created
This commit is contained in:
commit
cad94c7982
@ -1140,31 +1140,21 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private doShareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface) {
|
private doShareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface) {
|
||||||
const groupId = groupPositionMessage.groupId;
|
//delete previous group
|
||||||
const groupSize = groupPositionMessage.groupSize;
|
this.doDeleteGroup(groupPositionMessage.groupId);
|
||||||
|
|
||||||
const group = this.groups.get(groupId);
|
// TODO: circle radius should not be hard stored
|
||||||
if (group !== undefined) {
|
//create new group
|
||||||
group.setPosition(Math.round(groupPositionMessage.position.x), Math.round(groupPositionMessage.position.y));
|
const sprite = new Sprite(
|
||||||
} else {
|
this,
|
||||||
// TODO: circle radius should not be hard stored
|
Math.round(groupPositionMessage.position.x),
|
||||||
const positionX = 48;
|
Math.round(groupPositionMessage.position.y),
|
||||||
const positionY = 48;
|
groupPositionMessage.groupSize === 4 ? 'circleSprite-red' : 'circleSprite-white'
|
||||||
|
);
|
||||||
let texture = 'circleSprite-red';
|
sprite.setDisplayOrigin(48, 48);
|
||||||
if(groupSize < 4){
|
this.add.existing(sprite);
|
||||||
texture = 'circleSprite-white';
|
this.groups.set(groupPositionMessage.groupId, sprite);
|
||||||
}
|
return sprite;
|
||||||
const sprite = new Sprite(
|
|
||||||
this,
|
|
||||||
Math.round(groupPositionMessage.position.x),
|
|
||||||
Math.round(groupPositionMessage.position.y),
|
|
||||||
texture
|
|
||||||
);
|
|
||||||
sprite.setDisplayOrigin(positionX, positionY);
|
|
||||||
this.add.existing(sprite);
|
|
||||||
this.groups.set(groupId, sprite);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteGroup(groupId: number): void {
|
deleteGroup(groupId: number): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user