Go back to text wordbubbles
This commit is contained in:
@@ -634,89 +634,113 @@ var moonlightDialog = {
|
|||||||
"status": {
|
"status": {
|
||||||
"townsfolk-male" : {
|
"townsfolk-male" : {
|
||||||
"unaware" : [
|
"unaware" : [
|
||||||
"townsfolk-male/unaware/1.png",
|
"I'd rather be fishing.",
|
||||||
"townsfolk-male/unaware/2.png",
|
"Different day, same old stuff.",
|
||||||
"townsfolk-male/unaware/3.png",
|
"Oi! Where'd that trouble run\noff to now then?",
|
||||||
"townsfolk-male/unaware/4.png",
|
"The missus is off shoppin', and\nhere I am sittin' on\nme Jack Jones.",
|
||||||
"townsfolk-male/unaware/6.png",
|
"Oy I'm gonna have a butcher’s at\nthat new tailor's knickers\nhe has for sale.",
|
||||||
"townsfolk-male/unaware/7.png"
|
"I'm off to the pub to see the\nlads and chew the fat.",
|
||||||
|
"♪ ♫ Whistling ♪ ♫"
|
||||||
],
|
],
|
||||||
"concerned" : [
|
"concerned" : [
|
||||||
"townsfolk-male/concerned/2.png",
|
"Wha… what’s that? Who’s there?",
|
||||||
"townsfolk-male/concerned/5.png",
|
"Did you hear that?",
|
||||||
"townsfolk-male/concerned/7.png"
|
"Either I’m hearin’ things, or I\nneed to stop drinkin’ midday.",
|
||||||
|
"Oi? I don’t want no tomfoolery;\ncome out if you’re there!",
|
||||||
|
"Must be them darned kids again.",
|
||||||
|
"What’s that?",
|
||||||
|
"Did you see that?"
|
||||||
],
|
],
|
||||||
"alerted" : [
|
"alerted" : [
|
||||||
"townsfolk-male/alerted/10.png",
|
"Don't you come no closer, you hear?",
|
||||||
"townsfolk-male/alerted/11.png",
|
"Egads!",
|
||||||
"townsfolk-male/alerted/1.png",
|
"I'm getting’ outta here!",
|
||||||
"townsfolk-male/alerted/2.png",
|
"What's going on?!",
|
||||||
"townsfolk-male/alerted/4.png",
|
"Holy bejeezus!",
|
||||||
"townsfolk-male/alerted/5.png",
|
"Did you see that?",
|
||||||
"townsfolk-male/alerted/6.png",
|
"What're you doing?!",
|
||||||
"townsfolk-male/alerted/7.png",
|
"Get away!",
|
||||||
"townsfolk-male/alerted/8.png",
|
"Get away from me!",
|
||||||
"townsfolk-male/alerted/9.png"
|
"Stay away! I know Kung-fu! ... but\nthat would require bravery \nI don't have",
|
||||||
|
"Guards! GUARDS!"
|
||||||
],
|
],
|
||||||
"losthim" : [
|
"losthim" : [
|
||||||
"townsfolk-male/losthim/6.png",
|
"Whew. Glad that’s over.",
|
||||||
"townsfolk-male/losthim/7.png"
|
"I wasn’t scared!",
|
||||||
|
"Must’ve been intimidated by\nmy manly physique.",
|
||||||
|
"That’s right! Run away!",
|
||||||
|
"Aye, and don’t-cha come back!",
|
||||||
|
"Spoony Bard...",
|
||||||
|
"Bloody wanker!"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"townsfolk-female" : {
|
"townsfolk-female" : {
|
||||||
"unaware" : [
|
"unaware" : [
|
||||||
"townsfolk-female/unaware/1.png",
|
"My retro shake brings all the\nboys to the yard.",
|
||||||
"townsfolk-female/unaware/3.png",
|
"I'm off to get my Barnet sorted\nout. I’ll be the best looking\nlady at the gala.",
|
||||||
"townsfolk-female/unaware/4.png",
|
"It's always all itsy bitsy with\nthem boys at the Rub-a-Dub.",
|
||||||
"townsfolk-female/unaware/5.png"
|
"I need to get this shopping\nsorted out.",
|
||||||
|
"What a lovely evening. Perfect\nfor skulking, I would imagine."
|
||||||
],
|
],
|
||||||
"concerned" : [
|
"concerned" : [
|
||||||
"townsfolk-female/concerned/2.png",
|
"Wha… what’s that? Who’s there?",
|
||||||
"townsfolk-female/concerned/3.png",
|
"Did you hear that?",
|
||||||
"townsfolk-female/concerned/4.png",
|
"Martha? Is that you?",
|
||||||
"townsfolk-female/concerned/6.png",
|
"I don't want no tomfoolery.\nGo away!",
|
||||||
"townsfolk-female/concerned/7.png" ],
|
"What was that? This is how horror\ntheatre bits start…",
|
||||||
|
"What's that?",
|
||||||
|
"Did you see that?"
|
||||||
|
],
|
||||||
"alerted" : [
|
"alerted" : [
|
||||||
"townsfolk-female/alerted/1.png",
|
"Eeeek!",
|
||||||
"townsfolk-female/alerted/2.png",
|
"Stay away from me!",
|
||||||
"townsfolk-female/alerted/3.png",
|
"Guards! Guards!",
|
||||||
"townsfolk-female/alerted/4.png",
|
"What in the nine hells?",
|
||||||
"townsfolk-female/alerted/5.png",
|
"Get back or I'll swoon!",
|
||||||
"townsfolk-female/alerted/6.png"
|
"Help! He's after me virtue!"
|
||||||
],
|
],
|
||||||
"losthim" : [
|
"losthim" : [
|
||||||
"townsfolk-female/losthim/3.png"
|
"Good riddance! There’s too many\nmale protagonists in\ngames anyhow!",
|
||||||
|
"I sure am glad that’s over.",
|
||||||
|
"This town is going straight to hell.",
|
||||||
|
"I hope he doesn’t come back.",
|
||||||
|
"I hope he’s caught and hanged!"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"townsfolk-guard" : {
|
"townsfolk-guard" : {
|
||||||
"unaware" : [
|
"unaware" : [
|
||||||
"townsfolk-guard/unaware/1.png",
|
"Just doing my civic duty.",
|
||||||
"townsfolk-guard/unaware/2.png",
|
"Good day, citizens.",
|
||||||
"townsfolk-guard/unaware/4.png",
|
"Honor. Liberty. Justice.\nOh, and pancakes…\nI love pancakes.",
|
||||||
"townsfolk-guard/unaware/5.png",
|
"No loitering.",
|
||||||
"townsfolk-guard/unaware/6.png",
|
"I am the law.",
|
||||||
"townsfolk-guard/unaware/7.png"
|
"May Evil beware and may\nGood dress warmly and\neat plenty of fresh vegetables.",
|
||||||
|
"We're sworn to protect The City."
|
||||||
],
|
],
|
||||||
"concerned" : [
|
"concerned" : [
|
||||||
"townsfolk-guard/concerned/1.png",
|
"I sense law-breaking abound.",
|
||||||
"townsfolk-guard/concerned/2.png",
|
"Did you hear something?",
|
||||||
"townsfolk-guard/concerned/3.png",
|
"Did you see that?",
|
||||||
"townsfolk-guard/concerned/5.png",
|
"I know you're around here\nsomewhere, rat…",
|
||||||
"townsfolk-guard/concerned/6.png"
|
"Don't make me look for\nyou in hard-to-reach places!",
|
||||||
|
"The eyes play tricks\nlike tiny, round devils."
|
||||||
],
|
],
|
||||||
"alerted" : [
|
"alerted" : [
|
||||||
"townsfolk-guard/alerted/1.png",
|
"Surrender lawbreaker!",
|
||||||
"townsfolk-guard/alerted/2.png",
|
"Halt!",
|
||||||
"townsfolk-guard/alerted/4.png",
|
"Halt! In the name of the… umm, er… me!",
|
||||||
"townsfolk-guard/alerted/5.png",
|
"Prepare for justice, criminal!",
|
||||||
"townsfolk-guard/alerted/7.png",
|
"I am justice!",
|
||||||
"townsfolk-guard/alerted/8.png",
|
"There’s no escaping the law!",
|
||||||
"townsfolk-guard/alerted/9.png"
|
"Surrender thief!",
|
||||||
|
"Prepare to taste steel!",
|
||||||
|
"Clear the area! Nobody\npanic! I'll catch him!"
|
||||||
],
|
],
|
||||||
"losthim" : [
|
"losthim" : [
|
||||||
"townsfolk-guard/losthim/2.png",
|
"I’ll get you next time,\ncriminal scum.",
|
||||||
"townsfolk-guard/losthim/3.png",
|
"Defeat is a harsh mistress.",
|
||||||
"townsfolk-guard/losthim/4.png"
|
"Evil men may get away, but\njustice fights another day.",
|
||||||
|
"Wickedness flees, evading the\ncold steel of righteousness."
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -739,26 +763,39 @@ var moonlightDialog = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function stringSize(str, font)
|
||||||
|
{
|
||||||
|
var f = font || '12px arial',
|
||||||
|
o = $('<div>' + this + '</div>')
|
||||||
|
.css({'position': 'absolute', 'float': 'left', 'white-space': 'nowrap', 'visibility': 'hidden', 'font': f})
|
||||||
|
.appendTo($('body')),
|
||||||
|
w = o.width(),
|
||||||
|
h = o.height();
|
||||||
|
|
||||||
|
o.remove();
|
||||||
|
|
||||||
|
return [w, h];
|
||||||
|
}
|
||||||
|
|
||||||
var AISprite = function(game, x, y, key, frame) {
|
var AISprite = function(game, x, y, key, frame) {
|
||||||
this.enableWordBubble = function() {
|
this.enableWordBubble = function() {
|
||||||
this.enable_word_bubble = true;
|
this.enable_word_bubble = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearWordBubble = function() {
|
this.clearWordBubble = function() {
|
||||||
if ( this.bubble !== null )
|
this.clear_bubble = true;
|
||||||
this.bubble.destroy();
|
|
||||||
this.bubble = null;
|
|
||||||
this.enable_word_bubble = false;
|
this.enable_word_bubble = false;
|
||||||
timer = game.time.create(false);
|
timer = game.time.create(false);
|
||||||
timerev = timer.add(20000 + (game.rnd.integerInRange(0, 30) * 1000), this.enableWordBubble, this);
|
timerev = timer.add(10000, this.enableWordBubble, this);
|
||||||
timer.start()
|
timer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setWordBubble = function()
|
this.setWordBubble = function()
|
||||||
{
|
{
|
||||||
if ( this.bubble !== null || this.sprite_group == undefined || this.enable_word_bubble == false) {
|
if ( this.bubble !== null || this.sprite_group == undefined || this.word_bubble_enabled == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aistate = this.state & ( STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM );
|
aistate = this.state & ( STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM );
|
||||||
switch ( aistate ) {
|
switch ( aistate ) {
|
||||||
case STATE_UNAWARE: {
|
case STATE_UNAWARE: {
|
||||||
@@ -780,18 +817,24 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mylines = moonlightDialog['status'][this.sprite_group][aistate];
|
var mylines = moonlightDialog['status'][this.sprite_group][aistate];
|
||||||
var myline = mylines[game.rnd.integerInRange(0, mylines.length)]
|
text = mylines[game.rnd.integerInRange(0, mylines.length)];
|
||||||
this.bubble = game.add.sprite(this.x, this.y, myline);
|
style = {font: '14px Arial Bold', fill: '#ffffff', align: 'center'}
|
||||||
game.physics.arcade.enable(this.bubble);
|
this.text_size = stringSize(text, style['font']);
|
||||||
|
this.bubble = game.add.text(this.x, this.y, text, style);
|
||||||
this.bubble.x = this.x - (this.bubble.width / 2);
|
this.bubble_offsets = [ (this.body.width/2) + -(this.text_size[0] / 2), -( this.text_size[1]/2) ];
|
||||||
this.bubble.y = this.y - (this.bubble.height);
|
this.snap_bubble_position();
|
||||||
|
|
||||||
timer = game.time.create(false);
|
timer = game.time.create(false);
|
||||||
timerev = timer.add(5000, this.clearWordBubble, this);
|
timerev = timer.add(5000, this.clearWordBubble, this);
|
||||||
timer.start()
|
timer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.snap_bubble_position = function()
|
||||||
|
{
|
||||||
|
this.bubble.position.x = this.x + this.bubble_offsets[0];
|
||||||
|
this.bubble.position.y = this.y + this.bubble_offsets[1];
|
||||||
|
}
|
||||||
|
|
||||||
this.update = function()
|
this.update = function()
|
||||||
{
|
{
|
||||||
var running = false;
|
var running = false;
|
||||||
@@ -801,10 +844,13 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( this.bubble !== null ) {
|
if ( this.bubble !== null ) {
|
||||||
this.bubble.body.velocity.x = this.body.velocity.x;
|
if ( this.clear_bubble == true ) {
|
||||||
this.bubble.body.velocity.y = this.body.velocity.y;
|
this.bubble.destroy();
|
||||||
//this.bubble.x = this.x - (this.bubble.width / 2);
|
this.bubble = null;
|
||||||
//this.bubble.y = this.y - (this.bubble.height);
|
this.clear_bubble = false;
|
||||||
|
} else {
|
||||||
|
this.snap_bubble_position();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( game.rnd.integerInRange(0, 100) < 95 )
|
if ( game.rnd.integerInRange(0, 100) < 95 )
|
||||||
|
|||||||
Reference in New Issue
Block a user