Size wordbubbles to text
This commit is contained in:
@@ -821,12 +821,17 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mylines = moonlightDialog['status'][this.sprite_group][aistate];
|
var mylines = moonlightDialog['status'][this.sprite_group][aistate];
|
||||||
|
bubbleimg = game.cache.image('wordbubble')
|
||||||
text = mylines[game.rnd.integerInRange(0, mylines.length-1)];
|
text = mylines[game.rnd.integerInRange(0, mylines.length-1)];
|
||||||
style = {font: '14px Arial Bold', fill: '#ffffff'}
|
style = {font: '14px Arial Bold', fill: '#ffffff'}
|
||||||
this.text_size = stringSize(text, style['font']);
|
this.text_size = stringSize(text, style['font']);
|
||||||
this.bubble_sprite = game.add.sprite(this.x, this.y, 'wordbubble');
|
bubblegrp = game.state.states.game.bubble_group;
|
||||||
this.bubble_sprite.anchor.setTo(0.5, 0.5);
|
this.bubble_sprite = bubblegrp.add.sprite(this.x, this.y, 'wordbubble');
|
||||||
this.bubble_text = game.add.text(this.x, this.y, text, style);
|
this.bubble_sprite.anchor.setTo(0.5, 1.0);
|
||||||
|
this.bubble_sprite.scale(Number(this.text_size[0] / bubbleimg.width),
|
||||||
|
Number(this.text_size[1] / bubbleimg.height)
|
||||||
|
);
|
||||||
|
this.bubble_text = bubblegrp.add.text(this.x, this.y, text, style);
|
||||||
this.snap_bubble_position();
|
this.snap_bubble_position();
|
||||||
|
|
||||||
this.timer = game.time.create(false);
|
this.timer = game.time.create(false);
|
||||||
@@ -838,8 +843,8 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
{
|
{
|
||||||
this.bubble_sprite.x = this.x + 16;
|
this.bubble_sprite.x = this.x + 16;
|
||||||
this.bubble_sprite.y = this.y - 33;
|
this.bubble_sprite.y = this.y - 33;
|
||||||
this.bubble_text.position.x = this.x + 16 - 150 + 8;
|
this.bubble_text.position.x = this.bubble_sprite.x + 8;
|
||||||
this.bubble_text.position.y = this.y - 67 + 8;
|
this.bubble_text.position.y = this.bubble_sprite.y + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update = function()
|
this.update = function()
|
||||||
@@ -1085,6 +1090,8 @@ GameState.prototype.create = function()
|
|||||||
snd.update_new_values();
|
snd.update_new_values();
|
||||||
}, this)
|
}, this)
|
||||||
|
|
||||||
|
this.bubble_group = game.add.group();
|
||||||
|
|
||||||
this.uigroup = game.add.group();
|
this.uigroup = game.add.group();
|
||||||
this.game.time.advancedTiming = true;
|
this.game.time.advancedTiming = true;
|
||||||
this.fpsText = this.game.add.text(
|
this.fpsText = this.game.add.text(
|
||||||
|
|||||||
Reference in New Issue
Block a user