act 3 anims

This commit is contained in:
Nicky Case 2019-06-14 11:03:30 -04:00
parent 8666316125
commit 638395574e
18 changed files with 584 additions and 4 deletions

View File

@ -282,4 +282,10 @@
<script src="scripts/act2/Act2_Hong.js"></script>
<script src="scripts/act2/Act2_Beebee.js"></script>
<!-- ACT III -->
<script src="scripts/act3/Act3_SceneSetup.js"></script>
<script src="scripts/act3/Act3_BG.js"></script>
<script src="scripts/act3/Act3_Hong.js"></script>
<script src="scripts/act3/Act3_Beebee.js"></script>
<script src="scripts/main.js"></script>

218
scenes/act3_test.md Normal file
View File

@ -0,0 +1,218 @@
# act3
`SceneSetup.act3();`
h: meow
r: blah blah blah blah blah blah blah blah blah blah blah blah
```
Game.clearText();
publish("act3-out");
music('battle_dark', {volume:0.7, fade:1});
```
(...1500)
```
publish("hp_show");
```
n: FINAL ROUND: *FIGHT!*
h: Yelling
b: Yelling
```
Game.clearText();
publish("act3-in");
publish("hp_hide");
Game.FORCE_CANT_SKIP = true;
music(null,{fade:1});
```
(#act3_walkaway)
# act3_walkaway
`publish("start-walkaway-anim");`
(...2001)
`publish('hong-next')`
(...667)
`publish('hong-next')`
(...667)
`publish('hong-next')`
(...667)
`publish('hong-next')`
`Game.FORCE_CANT_SKIP = false;`
r: What's the matter, kid?
r: Ya *scared?*
```
publish('hong-next');
publish('hunter-bored');
```
h2: Yes.
h2: I'm scared.
`publish('hong-next')`
h2: And that's okay!
`publish('hong-next')`
h2: It's okay to be scared.
`publish('hong-next')`
(...500)
```
Game.clearText();
Game.FORCE_CANT_SKIP = true;
```
(...1167)
`publish('hong-next')`
(...833)
`publish('hong-next')`
(...1333)
`publish('hong-next')`
(...667)
`publish('hong-next')`
(...667)
`publish('hong-next')`
(...1333)
`publish('hong-next')`
(...501)
`publish('hong-next')`
`Game.FORCE_CANT_SKIP = false;`
(...1001)
r: Did they just lock the door?
r: ...
r: shit.
# act3_jump
`publish("start-jump-anim");`
(...2001)
`publish('hong-next')`
(...833)
`publish('hong-next')`
(...501)
`publish('hong-next')`
(...501)
`publish('hong-next')`
(...1167)
`publish('hong-next')`
(...1001)
`publish('hong-next')`
b: no...
`publish('hong-next')`
(...501)
`Game.clearText();`
(...1333)
`publish('hong-next')`
(...1333)
`publish('hong-next')`
b: no no no
(...501)
`Game.clearText();`
`publish('hong-next')`
(...2001)
`publish('hong-next')`
(...501)
`publish('hong-next')`
(...167)
`publish('hong-next')`
(...167)
`publish('hong-next')`
(...167)
```
publish('hong-next');
publish("hunter-shock");
```
(...833)
`publish('hong-next')`
(...167)
`publish('hong-next')`
(...167)
`publish('hong-next')`
b: NO!

View File

@ -9,7 +9,7 @@ SceneSetup.act2 = function(){
// RESET HP
HP.reset();
// ATTACKS
// ATTACKS (TODO: ACT I, ACT II...???)
_.attack_harm = 0;
_.attack_alone = 0;
_.attack_bad = 0;

186
scripts/act3/Act3_BG.js Normal file
View File

@ -0,0 +1,186 @@
Loader.addImages([
{ id:"rooftop_bg", src:"sprites/act3/rooftop_bg.png" },
{ id:"rooftop_hunter", src:"sprites/act3/hunter.png" },
{ id:"rooftop_hong", src:"sprites/act3/hong.png" }
]);
function BG_Rooftop(){
var self = this;
// Sprites!
self.bgSprite = new Sprite({
image: Library.images.rooftop_bg,
grid:{ width:1, height:1 },
frame:{ width:720, height:1200 },
});
self.hunterSprite = new Sprite({
image: Library.images.rooftop_hunter,
grid:{ width:4, height:1 },
frame:{ width:400, height:400 },
y: 200,
frameNames:[
"side_smile",
"side_neutral",
"front_evil",
"front_shock"
]
});
self.hongSprite = new Sprite({
image: Library.images.rooftop_hong,
grid:{ width:6, height:7 },
frame:{ width:720, height:800 },
y: 225
});
self.hongSprite.gotoFrame(3);
// Anxiety BG
self.anxiety = new BG_Anxiety();
// Characters
self.hong = new Act3_Hong();
self.beebee = new Act3_Beebee();
// LAYERS
self.layers = [
self.bgSprite,
self.hunterSprite,
self.anxiety,
self.hongSprite,
self.hong,
self.beebee
];
var PARALLAXES = [
0.5, // party bg
0.6, // HUNTER SPRITE
0.0, // anxiety bg
1.0, // HONG SPRITE
0.0, // battle hong
0.0, // battle beebee
];
var ALPHAS = [
1.0, // party bg
1.0, // HUNTER SPRITE
0.0, // anxiety bg
1.0, // HONG SPRITE
0.0, // battle hong
0.0, // battle beebee
];
var parallax = 0;
var parallaxTicker = 0;
var PARALLAXING = null;
self.update = function(){
// START PARALLAXING IN / OUT
if(PARALLAXING!=null){
if(PARALLAXING=="out"){
parallaxTicker += 1/60; // 0 to 1 in one second
}
if(PARALLAXING=="in"){
parallaxTicker -= 1/60; // 1 to 0 in one second
}
if(parallaxTicker>1) parallaxTicker = 1;
if(parallaxTicker<0) parallaxTicker = 0;
// 0 to -180 in one second, smoothed
var t = Math.cos(parallaxTicker*Math.TAU/2); // 1 to -1
t = (1-t)/2; // 0 to 1
parallax = -t*190;
// Anxiety Alpha
ALPHAS[2] = t;
// DONE
if(t==1 || t==0){
PARALLAXING = null;
// Stage 1 transition end
if(STAGE==1){
console.log("done");
ALPHAS[1] = 0; // HIDE Hunter
ALPHAS[3] = 0; // HIDE Old Hong
ALPHAS[4] = 1; // SHOW new hong
ALPHAS[5] = 1; // SHOW Beebee
}
}
}
// Anxiety BG
if(ALPHAS[2]>0){
self.anxiety.update(ALPHAS[2]);
if(ALPHAS[2]==1){ // if fully visible...
ALPHAS[0] = 0; // hide everything under
}else{
ALPHAS[0] = 1; // show everything under
}
}
};
self.draw = function(ctx){
ctx.save();
for(var i=0; i<self.layers.length; i++){
var layer = self.layers[i];
layer.x = PARALLAXES[i] * parallax;// - OFFSETS[i];
if(ALPHAS[i]>0){
ctx.globalAlpha = ALPHAS[i];
layer.draw(ctx);
}
}
ctx.restore();
};
var STAGE = 0;
var _subscriptions = [];
_subscriptions.push(
subscribe("act3-out", function(){
STAGE = 1;
PARALLAXING = "out";
sfx("whoosh"); // WHOOSH
}),
subscribe("act3-in", function(){
// SHOW ACTION, HIDE CHARS
ALPHAS[1] = 1; // SHOW Hunter
ALPHAS[3] = 1; // SHOW Roof Hong
ALPHAS[4] = 0; // HIDE battle Hong
ALPHAS[5] = 0; // HIDE battle Beebee
// WHOOSH
STAGE = 2;
PARALLAXING = "in";
sfx("whoosh");
}),
// JUMP OFF
subscribe("start-jump-anim", function(){
self.hongSprite.gotoFrame(4);
self.hunterSprite.gotoFrameByName("front_evil");
}),
subscribe("hong-next", function(){
self.hongSprite.nextFrame();
}),
subscribe("hunter-shock", function(){
self.hunterSprite.gotoFrameByName("front_shock");
}),
// WALK AWAY
subscribe("start-walkaway-anim", function(){
self.hongSprite.gotoFrame(23);
self.hunterSprite.gotoFrameByName("side_smile");
}),
subscribe("hunter-bored", function(){
self.hunterSprite.gotoFrameByName("side_neutral");
})
);
}

View File

@ -0,0 +1,77 @@
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:{
width: 4,
height: 2
},
frame:{
width: 720,
height: 500
},
anchor:{
x: 270,
y: 222
},
frameNames:[
"body_scared*",
"body_sad*",
"body_attacked*",
"body_dead*",
"eyes_blank",
"mouth_blank",
],
x: 270,
y: 258+222-60
};
// ANIM LOOPS
var animLoops = [];
// Inherit from Character!
Character.apply(self, [spriteConfig, animLoops]);
// Go To Frames!
self.gotoFrames({
body: "scared",
mouth: "blank",
eyes: "blank",
});
var _subscriptions = [];
_subscriptions.push( subscribe("bb", self.gotoFrames) );
_subscriptions.push( subscribe("attack_bb", self.showAttackedIcon) );
// 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
self.draw = function(ctx){
// Vibration!
ticker += 1/60;
self.characterSquash = 1 + Math.sin(ticker*Math.TAU*7)*0.01; // seven vibes per second
// Old Draw
_oldDraw.apply(self, arguments);
};
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Kill!
self.kill = function(){
_subscriptions.forEach(unsubscribe);
};
}

64
scripts/act3/Act3_Hong.js Normal file
View File

@ -0,0 +1,64 @@
Loader.addImages([
{ id:"act3_hong", src:"sprites/act3/fight_hong.png" }
]);
function Act3_Hong(){
var self = this;
// SPRITE CONFIG!
var spriteConfig = {
image: Library.images.act3_hong,
grid:{
width: 4,
height: 1
},
frame:{
width: 720,
height: 400
},
anchor:{
x: 59,
y: 180
},
frameNames:[
"body_angry*",
"body_drink*",
"body_stop*",
"body_foobar*",
"mouth_blank",
"eyes_blank",
],
x: 59,
y: 258+180
};
// ANIM LOOPS
var animLoops = [];
// Inherit from Character!
Character.apply(self, [spriteConfig, animLoops]);
// Go To Frames!
self.gotoFrames({
body: "angry",
mouth: "blank",
eyes: "blank",
});
var _subscriptions = [];
_subscriptions.push( subscribe("hong", self.gotoFrames) );
//_subscriptions.push( subscribe("attack_hong", self.showAttackedIcon) );
// Draw
self.characterSpeakerID = "h";
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Kill!
self.kill = function(){
_subscriptions.forEach(unsubscribe);
};
}

View File

@ -0,0 +1,25 @@
Loader.addSounds([
{ id:"music_party2", src:"sounds/music/party2.mp3" },
{ id:"music_battle_dark", src:"sounds/music/battle_dark.mp3" }
]);
SceneSetup.act3 = function(){
Game.resetScene();
// RESET HP
HP.reset();
// ATTACKS
_.attack_harm = 0;
_.attack_alone = 0;
_.attack_bad = 0;
// Music
music('party2', {volume:0.6});
// Background
var bg = new BG_Rooftop();
Game.scene.children.push(bg);
};

View File

@ -699,7 +699,7 @@ Game.executeWait = function(line){
// Specific wait-time, don't skip?
var waitTimeString = waitTime+"";
var lastDigit = waitTimeString[waitTimeString.length-1];
var cantSkip = (lastDigit=="1"); // CAN'T SKIP.
var cantSkip = (lastDigit!="0"); // CAN'T SKIP.
if(!cantSkip && Game.CLICK_TO_ADVANCE && waitTime<999){ // hack: unless the wait is long.
waitTime = 0;

View File

@ -53,6 +53,9 @@ function Sprite(config){
self.currentFrame = index;
self.currentFrameName = self.frameNames[self.currentFrame] || "";
};
self.nextFrame = function(){
self.gotoFrame(self.currentFrame+1);
};
self.gotoFrameByName = function(name){
var index = self.frameNames.indexOf(name);
self.gotoFrame(index);

View File

@ -4,7 +4,8 @@ Loader.addScenes([
//"scenes/act1.md",
//"scenes/act1_end.md",
//"scenes/PROMO.md"
"scenes/act2.md",
//"scenes/act2.md",
"scenes/act3_test.md",
]);
Loader.load(function(progress){
@ -27,6 +28,6 @@ subscribe("START_GAME", function(){
$("#loading").style.display = "none";
Game.start();
Game.goto("act2");
Game.goto("act3");
});

Binary file not shown.

BIN
sounds/music/party2.mp3 Normal file

Binary file not shown.

BIN
sprites/act3/fight_bb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
sprites/act3/fight_hong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
sprites/act3/hong.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

BIN
sprites/act3/hospital.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
sprites/act3/hunter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
sprites/act3/rooftop_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB