Size wordbubbles to text

This commit is contained in:
2014-06-15 20:19:16 -07:00
parent a20de3a575
commit 3970b70c50
2 changed files with 1 additions and 10 deletions

View File

@@ -285,7 +285,6 @@
"name":"BigTopCustomer2", "name":"BigTopCustomer2",
"properties": "properties":
{ {
"sprite_canmove":"false",
"sprite_group":"townsfolk-female", "sprite_group":"townsfolk-female",
"sprite_name":"townsfolk-female-2" "sprite_name":"townsfolk-female-2"
}, },
@@ -301,7 +300,6 @@
"name":"BigTopCustomer2", "name":"BigTopCustomer2",
"properties": "properties":
{ {
"sprite_canmove":"false",
"sprite_group":"townsfolk-male", "sprite_group":"townsfolk-male",
"sprite_name":"townsfolk-male-3" "sprite_name":"townsfolk-male-3"
}, },

View File

@@ -567,7 +567,6 @@ var moonlightDialog = {
}, },
"townsfolk-guard" : { "townsfolk-guard" : {
"unaware" : [ "unaware" : [
"This is some\nmultiline text\nin this bitch",
"Just doing my civic duty.", "Just doing my civic duty.",
"Good day, citizens.", "Good day, citizens.",
"Honor. Liberty. Justice.\nOh, and pancakes…\nI love pancakes.", "Honor. Liberty. Justice.\nOh, and pancakes…\nI love pancakes.",
@@ -827,18 +826,13 @@ 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.getImage('wordbubble'); bubbleimg = game.cache.getImage('wordbubble');
//text = mylines[game.rnd.integerInRange(0, mylines.length-1)]; text = mylines[game.rnd.integerInRange(0, mylines.length-1)];
text = mylines[0];
console.log(text);
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'); this.bubble_sprite = game.add.sprite(this.x, this.y, 'wordbubble');
this.bubble_sprite.anchor.setTo(0.5, 1.0); this.bubble_sprite.anchor.setTo(0.5, 1.0);
console.log(this.text_size);
console.log(this.bubble_sprite.scale);
this.bubble_sprite.scale.x = Number((this.text_size[0] + 16) / bubbleimg.width); this.bubble_sprite.scale.x = Number((this.text_size[0] + 16) / bubbleimg.width);
this.bubble_sprite.scale.y = Number((this.text_size[1] + 16) / bubbleimg.height); this.bubble_sprite.scale.y = Number((this.text_size[1] + 16) / bubbleimg.height);
console.log(this.bubble_sprite);
this.bubble_text = game.add.text(this.x, this.y, text, style); this.bubble_text = game.add.text(this.x, this.y, text, style);
this.snap_bubble_position(); this.snap_bubble_position();
@@ -915,7 +909,6 @@ var AISprite = function(game, x, y, key, frame) {
} }
this.update_new_values = function() { this.update_new_values = function() {
console.log(this);
if ( this.timer !== null ) if ( this.timer !== null )
this.timer.stop(); this.timer.stop();
this.animations.destroy(); this.animations.destroy();