2019-06-14 15:03:30 +00:00
|
|
|
Loader.addImages([
|
|
|
|
{ id:"act3_bb", src:"sprites/act3/fight_bb.png" }
|
|
|
|
]);
|
|
|
|
|
|
|
|
function Act3_Beebee(){
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
// SPRITE CONFIG!
|
|
|
|
var spriteConfig = {
|
|
|
|
image: Library.images.act3_bb,
|
|
|
|
grid:{
|
2019-07-30 20:17:36 +00:00
|
|
|
width: 8,
|
|
|
|
height: 3
|
2019-06-14 15:03:30 +00:00
|
|
|
},
|
|
|
|
frame:{
|
|
|
|
width: 720,
|
|
|
|
height: 500
|
|
|
|
},
|
|
|
|
anchor:{
|
|
|
|
x: 270,
|
2019-07-30 20:17:36 +00:00
|
|
|
y: 223
|
2019-06-14 15:03:30 +00:00
|
|
|
},
|
|
|
|
frameNames:[
|
2019-07-30 20:17:36 +00:00
|
|
|
|
|
|
|
"body_normal_1",
|
|
|
|
"body_normal_2",
|
|
|
|
"body_normal_3",
|
|
|
|
"body_normal_4",
|
|
|
|
"mouth_sorry",
|
|
|
|
"mouth_sorry_talk",
|
|
|
|
"eyes_sorry_down",
|
|
|
|
"eyes_sorry",
|
|
|
|
|
|
|
|
"eyes_sorry_up",
|
|
|
|
"mouth_normal",
|
|
|
|
"mouth_normal_talk",
|
|
|
|
"eyes_oh_crap",
|
|
|
|
"eyes_start",
|
|
|
|
"eyes_normal",
|
|
|
|
"eyes_angry",
|
|
|
|
"eyes_sad",
|
|
|
|
|
|
|
|
"mouth_ignore",
|
|
|
|
"mouth_ignore_talk",
|
|
|
|
"eyes_ignore",
|
|
|
|
"eyes_ignore_oh_crap",
|
2019-06-14 15:03:30 +00:00
|
|
|
"body_attacked*",
|
|
|
|
"body_dead*",
|
2019-07-30 20:17:36 +00:00
|
|
|
//"eyes_blank", // BLANK
|
|
|
|
//"mouth_blank", // BLANK
|
|
|
|
|
2019-06-14 15:03:30 +00:00
|
|
|
],
|
|
|
|
x: 270,
|
|
|
|
y: 258+222-60
|
|
|
|
};
|
|
|
|
|
|
|
|
// ANIM LOOPS
|
|
|
|
var animLoops = [];
|
|
|
|
|
|
|
|
// Inherit from Character!
|
|
|
|
Character.apply(self, [spriteConfig, animLoops]);
|
|
|
|
|
|
|
|
// Go To Frames!
|
|
|
|
self.gotoFrames({
|
2019-07-30 20:17:36 +00:00
|
|
|
body: "normal_1",
|
|
|
|
mouth: "normal",
|
|
|
|
eyes: "start",
|
2019-06-14 15:03:30 +00:00
|
|
|
});
|
|
|
|
var _subscriptions = [];
|
|
|
|
_subscriptions.push( subscribe("bb", self.gotoFrames) );
|
|
|
|
_subscriptions.push( subscribe("attack_bb", self.showAttackedIcon) );
|
2019-07-30 20:17:36 +00:00
|
|
|
_subscriptions.push( subscribe("DONE_SPEAKING", self.whenDoneSpeaking) );
|
|
|
|
_subscriptions.push(
|
|
|
|
subscribe("bb_STOP_VIBRATING", function(){
|
|
|
|
self.isVibrating = false;
|
|
|
|
})
|
|
|
|
);
|
2019-06-14 15:03:30 +00:00
|
|
|
|
|
|
|
// Draw! Same as earlier except a lot of vibration
|
|
|
|
var ticker = 0;
|
|
|
|
var _oldDraw = self.draw;
|
|
|
|
self.characterSpeakerID = "b";
|
|
|
|
self.bounceHookes = 0.25; // loose
|
|
|
|
self.bounceDamp = 0.9; // loose
|
2019-07-30 20:17:36 +00:00
|
|
|
self.isVibrating = true;
|
2019-09-09 16:37:58 +00:00
|
|
|
self.draw = function(ctx, delta){
|
2019-06-14 15:03:30 +00:00
|
|
|
|
|
|
|
// Vibration!
|
2019-09-09 16:37:58 +00:00
|
|
|
ticker += delta;
|
2019-07-30 20:17:36 +00:00
|
|
|
if(self.isVibrating){
|
|
|
|
self.characterSquash = 1 + Math.sin(ticker*Math.TAU*7)*0.01; // seven vibes per second
|
|
|
|
}else{
|
|
|
|
self.characterSquash = 1;
|
|
|
|
}
|
2019-06-14 15:03:30 +00:00
|
|
|
|
|
|
|
// Old Draw
|
|
|
|
_oldDraw.apply(self, arguments);
|
|
|
|
|
|
|
|
};
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Kill!
|
|
|
|
self.kill = function(){
|
|
|
|
_subscriptions.forEach(unsubscribe);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|