diff --git a/index.html b/index.html index 275e13d..9adc77a 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - Anxiety Adventure! + Adventures with Anxiety! @@ -15,7 +15,7 @@
paused -
click anywhere to continue the pain
+
click anywhere to keep freaking out
@@ -34,6 +34,7 @@ + diff --git a/scripts/act1/Act1_BG.js b/scripts/act1/Act1_BG.js new file mode 100644 index 0000000..27a2a08 --- /dev/null +++ b/scripts/act1/Act1_BG.js @@ -0,0 +1,11 @@ +/***************************** + +Draw the parallax... +and also have the Anxiety Battle Background in it? + +*****************************/ +function BG_Act1(){ + + // + +} \ No newline at end of file diff --git a/scripts/act1/Act1_Beebee.js b/scripts/act1/Act1_Beebee.js index 2efd813..924ebf9 100644 --- a/scripts/act1/Act1_Beebee.js +++ b/scripts/act1/Act1_Beebee.js @@ -1,3 +1,7 @@ +Loader.addImages([ + { id:"act1_beebee", src:"sprites/act1/act1_beebee.png" } +]); + function Act1_Beebee(){ var self = this; diff --git a/scripts/act1/Act1_Hong.js b/scripts/act1/Act1_Hong.js index 8e1b134..2335723 100644 --- a/scripts/act1/Act1_Hong.js +++ b/scripts/act1/Act1_Hong.js @@ -1,3 +1,7 @@ +Loader.addImages([ + { id:"act1_hong", src:"sprites/act1/act1_hong.png" } +]); + function Act1_Hong(){ var self = this; diff --git a/scripts/game/Game.js b/scripts/game/Game.js index b56de22..94963ff 100644 --- a/scripts/game/Game.js +++ b/scripts/game/Game.js @@ -26,6 +26,9 @@ window.bb = function(){ // Init Game.init = function(){ + // HP! + window.HP = new HitPoints(); + // Animation! Game.wordsDOM.style.top = "80px"; var animloop = function(){ @@ -604,7 +607,7 @@ Game.updateCanvas = function(){ ctx.restore(); // Draw HP - HP.draw(); + //HP.draw(); }; diff --git a/scripts/game/HP.js b/scripts/game/HP.js index bc411e7..eb370d0 100644 --- a/scripts/game/HP.js +++ b/scripts/game/HP.js @@ -1,5 +1,6 @@ -// Singleton - it's always there! -window.HP = new HitPoints(); +Loader.addImages([ + { id:"hp", src:"sprites/ui/hp.png" } +]); // The Class! function HitPoints(){ @@ -17,8 +18,7 @@ function HitPoints(){ self.dom.appendChild(self.canvas); // My sprite - self.image = new Image(); - self.image.src = "sprites/hp.png"; + self.image = Library.images.hp; // My stats self.reset = function(){ diff --git a/scripts/intro/Intro_BG.js b/scripts/intro/Intro_BG.js new file mode 100644 index 0000000..712e8a4 --- /dev/null +++ b/scripts/intro/Intro_BG.js @@ -0,0 +1,150 @@ +Loader.addImages([ + { id:"intro_bg", src:"sprites/intro/intro_bg.png" }, + { id:"intro_anim", src:"sprites/intro/intro_anim.png" } +]); + +function BG_Intro(){ + + var self = this; + + // Sprite! + var spriteConfig = { + image: Library.images.intro_bg, + grid:{ + width: 2, + height: 3 + }, + frame:{ + width: 1200, + height: 900 + }, + anchor:{ + x: 0, + y: 0 + }, + frameNames:[ + "sky", + "clouds", + "buildings", + "grass", + "stump", + "bag" + ], + x: 0, + y: 0 + }; + self.layers = []; + ["sky","clouds","buildings","grass","stump"].forEach(function(layerName){ + var sprite = new Sprite(spriteConfig); + sprite.gotoFrameByName(layerName); + self.layers.push(sprite); + }); + + // HONG + var hongSpriteConfig = { + image: Library.images.intro_anim, + grid:{ + width: 4, + height: 7 + }, + frame:{ + width: 1200, + height: 900 + }, + anchor:{ + x: 0, + y: 0 + }, + x: 0, + y: 0 + }; + var hongSprite = new Sprite(hongSpriteConfig); + self.layers.push(hongSprite); + + // DRAW + var BG_WIDTH = 360; + var BG_HEIGHT = 450; + var PARALLAXES = [ + 0, // sky + 0.1, // clouds + 0.25, // buildings + 0.5, // grass + 1.0, // stump + 1.0, // HONG + ]; + var OFFSETS = [ + 0, + 0, // clouds + 0, + 0, + 20, + 20 + ] + // TODO: CLOUDS MOVE BY SELF + var ticker = 0; + self.draw = function(ctx){ + + var parallax = 0; //= -(1+Math.sin(ticker))*90; + ticker += 1/60; + + // CLOUD OFFSET + OFFSETS[1] = -80 + ticker*3 + + for(var i=0; i