1. . .
var speed = 6;
bob.onEnterFrame = function()
{
if (Key.isDown(Key.LEFT))
{
this._x -= speed;
}
if (Key.isDown(Key.RIGHT))
{
this._x += speed;
}
if (Key.isDown(Key.UP))
{
this._y -= speed;
}
if (Key.isDown(Key.DOWN))
{
this._y += speed;
}
};
// .
// ,
var bob1_phrases = [", !", " , ?", ", ?"];
var bob2_phrases = ["..", " ?", ", !"];
function setDialogues(mc:MovieClip, phrases:Array, yy:Number)
{
var fi_fa = mc.attachMovie("ff", "ff" + mc._name, _root.getNextHighestDepth());
fi_fa._y = yy;
fi_fa._visible = false;
mc.curPhrase = 0;
mc.maxPhrase = phrases.length - 1;
mc.speaking = false;
mc.onEnterFrame = function()
{
var dx = bob._x - this._x;
var dy = bob._y - this._y;
// 120 .
if (Math.abs(dx) < 120 && Math.abs(dy) < 120)
{
if (Key.isDown(Key.SPACE) && this.speaking == false)
{
this.speaking = true;
fi_fa._visible = true;
fi_fa.txt.text = phrases[this.curPhrase];
if (this.curPhrase >= this.maxPhrase)
{
this.curPhrase = 0;
}
else
{
this.curPhrase++;
}
}
}
else
{
this.speaking = false;
this.timer = 0;
fi_fa.txt.text = "";
fi_fa._visible = false;
}
if (this.speaking)
{
this.timer == undefined ? this.timer = 0 : this.timer++;
//20
if (this.timer >= 20)
{
this.timer = 0;
this.speaking = false;
fi_fa.txt.text = "";
fi_fa._visible = false;
}
}
};
}
setDialogues(bob1,bob1_phrases,-30);
setDialogues(bob2,bob2_phrases,-30);
2
var speed = 6;
love.onEnterFrame = function()
{
if (Key.isDown(Key.LEFT))
{
this._x -= speed;
}
if (Key.isDown(Key.RIGHT))
{
this._x += speed;
}
if (Key.isDown(Key.UP))
{
this._y -= speed;
}
if (Key.isDown(Key.DOWN))
{
this._y += speed;
}
};
var bob1_phrases = ["! ", " , , !", " ", " «»!"];
var bob2_phrases = [" ", " !", " ,", ", ", " "];
var bob1_voices = ["m1g1", "m1g2", "m1g3"];
var bob2_voices = ["m2g1", "m2g2", "m2g3"];
function setDialogues(mc:MovieClip, phrases:Array, voices:Array, yy:Number)
{
var f_fifa = mc.attachMovie("fifa", "fifa" + mc._name, _root.getNextHighestDepth());
f_fifa._y = yy;
f_fifa._visible = false;
mc.curPhrase = 0;
mc.maxPhrase = phrases.length - 1;
mc.speaking = false;
mc.onEnterFrame = function()
{
var fx = love._x - this._x;
var fy = love._y - this._y;
if (Math.abs(fx) < 120 && Math.abs(fy) < 120)
{
if (Key.isDown(Key.SPACE) && this.speaking == false)
{
this.speaking = true;
f_fifa._visible = true;
f_fifa.txt.text = phrases[this.curPhrase];
sound = new Sound(mc);
sound.attachSound (voices[this.curPhrase]);
sound.start();
if (this.curPhrase >= this.maxPhrase)
{
this.curPhrase = 0;
}
else
{
this.curPhrase++;
}
}
}
else
{
this.speaking = false;
this.timer = 0;
f_fifa.txt.text = "";
f_fifa._visible = false;
}
if (this.speaking)
{
this.timer == undefined ? this.timer = 0 : this.timer++;
if (this.timer >= 15)
{
this.timer = 0;
this.speaking = false;
f_fifa.txt.text = "";
f_fifa._visible = false;
}
}
};
}
setDialogues(bob1,bob2_phrases,bob2_voices,-30);
setDialogues(bob2,bob1_phrases,bob1_voices,-30);