Word bubbles

This commit is contained in:
2014-06-11 22:51:05 -07:00
parent 77478006a6
commit 5f20feb990

View File

@@ -167,8 +167,8 @@ var moonlightSettings = {
var moonlightDialog = { var moonlightDialog = {
"status": { "status": {
("" + SPRITE_TOWNSFOLK_MALE) : { "townsfolk-male" : {
("" + STATE_UNAWARE) : [ "unaware" : [
"I'd rather be fishing.", "I'd rather be fishing.",
"Different day, same old stuff.", "Different day, same old stuff.",
"Oi! Where'd that trouble run off to now then?", "Oi! Where'd that trouble run off to now then?",
@@ -177,7 +177,7 @@ var moonlightDialog = {
"I'm off to the pub to see the lads and chew the fat.", "I'm off to the pub to see the lads and chew the fat.",
"♪ ♫ Whistling ♪ ♫" "♪ ♫ Whistling ♪ ♫"
], ],
("" + STATE_CONCERNED) : [ "concerned" : [
"Wha… whats that? Whos there?", "Wha… whats that? Whos there?",
"Did you hear that?", "Did you hear that?",
"Either Im hearin things, or I need to stop drinkin midday.", "Either Im hearin things, or I need to stop drinkin midday.",
@@ -186,7 +186,7 @@ var moonlightDialog = {
"Whats that?", "Whats that?",
"Did you see that?" "Did you see that?"
], ],
("" + STATE_ALERTED) : [ "alerted" : [
"Don't you come no closer, you hear?", "Don't you come no closer, you hear?",
"Egads!", "Egads!",
"I'm getting outta here!", "I'm getting outta here!",
@@ -199,7 +199,7 @@ var moonlightDialog = {
"Stay away! I know Kung-fu! ... but that would require bravery I don't have", "Stay away! I know Kung-fu! ... but that would require bravery I don't have",
"Guards! GUARDS!" "Guards! GUARDS!"
], ],
("" + STATE_LOSTHIM): [ "losthim" : [
"Whew. Glad thats over.", "Whew. Glad thats over.",
"I wasnt scared!", "I wasnt scared!",
"Mustve been intimidated by manly physique.", "Mustve been intimidated by manly physique.",
@@ -209,17 +209,17 @@ var moonlightDialog = {
"Bloody wanker!" "Bloody wanker!"
] ]
}, },
("" + SPRITE_TOWNSFOLK_FEMALE): { "townsfolk-female" : {
("" + STATE_UNAWARE) : [], "unaware" : [],
("" + STATE_CONCERNED) : [], "concerned" : [],
("" + STATE_ALERTED) : [], "alerted" : [],
("" + STATE_LOSTHIM): [] "losthim" : []
}, },
SPRITE_TOWNSFOLK_GUARD: { "townsfolk-guard" : {
("" + STATE_UNAWARE) : [], "unaware" : [],
("" + STATE_CONCERNED) : [], "concerned" : [],
("" + STATE_ALERTED) : [], "alerted" : [],
("" + STATE_LOSTHIM): [] "losthim" : []
} }
}, },
"conversations": { "conversations": {
@@ -272,12 +272,25 @@ var AISprite = function(game, x, y, spritetype) {
} }
//this.bubble = game.add.group() //this.bubble = game.add.group()
aistate = this.state & ( STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM ); aistate = this.state & ( STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM );
console.log(this.sprite_group); switch ( aistate ) {
console.log(aistate); case STATE_UNAWARE: {
console.log(moonlightDialog); aistate = "unaware";
console.log(moonlightDialog['status']); break;
console.log(moonlightDialog['status'][this.sprite_group]); }
console.log(moonlightDialog['status'][this.sprite_group][aistate]); case STATE_CONCERNED: {
aistate = "concerned";
break;
}
case STATE_ALERTED: {
aistate = "alerted";
break;
}
case STATE_LOSTHIM: {
aistate = "losthim";
break;
}
}
var mylines = moonlightDialog['status'][this.sprite_group][aistate]; var mylines = moonlightDialog['status'][this.sprite_group][aistate];
var text = mylines[game.rnd.integerInRange(0, mylines.length)]; var text = mylines[game.rnd.integerInRange(0, mylines.length)];
var style = {font: '12px Arial Bold', fill: '#ffffff', align: 'center'} var style = {font: '12px Arial Bold', fill: '#ffffff', align: 'center'}
@@ -341,7 +354,9 @@ var AISprite = function(game, x, y, spritetype) {
game.physics.arcade.enable(this); game.physics.arcade.enable(this);
this.body.collideWorldBounds = true; this.body.collideWorldBounds = true;
this.sprite_group = Math.round(1 + (spritetype / 4)); this.sprite_group = ['townsfolk-male',
'townsfolk-female',
'townsfolk-guard'][Math.round(1 + (spritetype / 4))];
addAnimation(this, 'bipedwalkleft'); addAnimation(this, 'bipedwalkleft');
addAnimation(this, 'bipedwalkright'); addAnimation(this, 'bipedwalkright');