-
-
-
-
+
+
+
+
-
+
-
+
diff --git a/sound/coin_up3.mp3 b/sound/coin_up3.mp3
new file mode 100644
index 0000000..a33a1b4
Binary files /dev/null and b/sound/coin_up3.mp3 differ
diff --git a/sound/crash2.mp3 b/sound/crash2.mp3
new file mode 100644
index 0000000..9940735
Binary files /dev/null and b/sound/crash2.mp3 differ
diff --git a/sound/powerup2.mp3 b/sound/powerup2.mp3
new file mode 100644
index 0000000..b574479
Binary files /dev/null and b/sound/powerup2.mp3 differ
diff --git a/sound/coin_up.ogg b/sound/prev/coin_up.ogg
similarity index 100%
rename from sound/coin_up.ogg
rename to sound/prev/coin_up.ogg
diff --git a/sound/coin_up2.ogg b/sound/prev/coin_up2.ogg
similarity index 100%
rename from sound/coin_up2.ogg
rename to sound/prev/coin_up2.ogg
diff --git a/sound/crash.ogg b/sound/prev/crash.ogg
similarity index 100%
rename from sound/crash.ogg
rename to sound/prev/crash.ogg
diff --git a/sound/powerup1.ogg b/sound/prev/powerup1.ogg
similarity index 100%
rename from sound/powerup1.ogg
rename to sound/prev/powerup1.ogg
diff --git a/sound/turn1.ogg b/sound/prev/turn1.ogg
similarity index 100%
rename from sound/turn1.ogg
rename to sound/prev/turn1.ogg
diff --git a/sound/turn2.ogg b/sound/prev/turn2.ogg
similarity index 100%
rename from sound/turn2.ogg
rename to sound/prev/turn2.ogg
diff --git a/sound/turn3.ogg b/sound/prev/turn3.ogg
similarity index 100%
rename from sound/turn3.ogg
rename to sound/prev/turn3.ogg
diff --git a/sound/turn4.ogg b/sound/prev/turn4.ogg
similarity index 100%
rename from sound/turn4.ogg
rename to sound/prev/turn4.ogg
diff --git a/sound/turn5.mp3 b/sound/turn5.mp3
new file mode 100644
index 0000000..cb6f3ec
Binary files /dev/null and b/sound/turn5.mp3 differ
diff --git a/src/build_number.js b/src/build_number.js
index 0f65c1e..3c49b62 100644
--- a/src/build_number.js
+++ b/src/build_number.js
@@ -1,2 +1,2 @@
- // this file is created by the build script
-var BUILD_NUMBER=166
\ No newline at end of file
+// this file is created by the build script
+var BUILD_NUMBER=182;
diff --git a/src/main.js b/src/main.js
index 91bb0d0..9abaf55 100644
--- a/src/main.js
+++ b/src/main.js
@@ -323,11 +323,16 @@ function animate(elapsed) {
world.staticDraw[si].advance(elapsed);
}
for(var bi in world.bonuses) {
- world.bonuses[bi].advance(elapsed);
+ if (!world.bonuses[bi].advance(elapsed)) {
+ delete world.bonuses[bi]
+ }
}
- world.background.advance(elapsed);
+ if (!game.isPaused() || game._startPause) // on the start we want to animate the back
+ world.background.advance(elapsed); // 3d background stripes
+ if (c2d.menuAnim)
+ c2d.menuAnim(elapsed)
return doDraw;
//writeDebug(elapsed + " " + iterCount );
@@ -390,7 +395,8 @@ function tick() {
if (enabled3d) // enabled3d can change in animate
drawScene();
- if (gameConf.printFps) dispFps(elapsed);
+ if (gameConf.printFps)
+ dispFps(elapsed);
}
@@ -401,6 +407,7 @@ function deployBonus() {
if (!world.ready || !resources._ready || !enabled3d || game.isPaused())
return;
+ //var chance = 100
var chance = (world.bonuses.length > 0)?0.2:3
// 5% chance every 500 msec is 1 in 10 sec
// 2% chance every 500 msec is 1 in 25 sec
diff --git a/src/screens2d.js b/src/screens2d.js
index a483d96..0954d38 100644
--- a/src/screens2d.js
+++ b/src/screens2d.js
@@ -267,9 +267,26 @@ C2d.prototype.verbosePauseScreen = function()
return true;
}
- this.drawGameState();
+ this.fadeIn()
+ //this.drawGameState();
+}
+
+C2d.prototype.fadeIn = function()
+{
+ canvas2d.style.opacity = 0
+ this.menuAnim = function(elapsed) {
+ op = parseFloat(canvas2d.style.opacity) + elapsed * 0.008
+ if (op >= 1) {
+ op = 1
+ c2d.menuAnim = null
+ }
+ //writeDebug(op)
+ canvas2d.style.opacity = op
+ this.drawGameState();
+ }
}
+
C2d.prototype.loadingScreen = function(pc)
{
this.blankScr("black");
@@ -774,16 +791,20 @@ LifesRenderable.ROTX_SPEED = 90 / 1000;
LifesRenderable.ROTY_SPEED = 180 / 1000;
// a pass is either a death or a new life
LifesRenderable.PASS_PEAK_LIGHT = 3;
-LifesRenderable.PASS_PEAK_TIME = 1000;
-LifesRenderable.PASS_TOTAL_TIME = 2000; // starting from the beginning
+LifesRenderable.PASS_PEAK_TIME = 500; //1000;
+LifesRenderable.PASS_TOTAL_TIME = 1000; //2000; // starting from the beginning
// static function.
// climb from 1 to 3 and then back to 0 again
// if its time for the end of the animation, call onstop.
-// this is better than using a return value because I don't need to checn the return value when this function returns.
-LifesRenderable.getLightFactor = function(msec, onstop) {
-
+// this is better than using a return value because I don't need to check the return value when this function returns.
+LifesRenderable.getLightFactor = function(msec, onstop) {
if (msec >= 0) {
+ d = 1 + 2*Math.sin(msec/LifesRenderable.PASS_TOTAL_TIME * Math.PI)
+ //writeDebug(msec + " " + d)
+ if (d > 0)
+ return d; // when it goes negative, time to remove it
+
if (msec <= LifesRenderable.PASS_PEAK_TIME)
return 1 + (LifesRenderable.PASS_PEAK_LIGHT / LifesRenderable.PASS_PEAK_TIME) * msec;
else if (msec <= LifesRenderable.PASS_TOTAL_TIME)
@@ -840,7 +861,6 @@ LifesRenderable.prototype.startDeath = function() {
this.activeDeath = 0;
}
LifesRenderable.prototype.startOneUp = function() {
-
this.activeOneUp = 0;
}
diff --git a/src/sfx.js b/src/sfx.js
index 108aa42..c9159d9 100644
--- a/src/sfx.js
+++ b/src/sfx.js
@@ -192,8 +192,15 @@ function LifeBonus(index) {
this.angley = 0;
this.elapsed = 0;
this.inflate = 0; // range [0, 1]
- c2d.addMessage("Life bonus appeared");
-
+ this.active = true;
+ this.removeElapsed = -1; // remove animation
+ this.alpha = null;
+ c2d.addMessage("Life bonus appeared");
+}
+
+LifeBonus.prototype.startRemove = function() {
+ this.removeElapsed = 0;
+ this.alpha = 1.0;
}
LifeBonus.prototype.getColor = function(angle) {
@@ -216,15 +223,26 @@ LifeBonus.prototype.draw = function() {
mv.scale(s * this.inflate);
mv.rotateY(this.anglex);
mv.rotateX(this.angley);
-
- shaderProg.setColorv(this.getColor(this.anglex));
+ color = this.getColor(this.anglex)
+ if (this.alpha == null) {
+ shaderProg.setColorv(color);
+ }
+ else {
+ gl.enable(gl.BLEND);
+ shaderProg.setColor4(color[0], color[1], color[2], this.alpha);
+ }
renderModel(resources.life);
+ if (this.alpha != null) {
+ gl.disable(gl.BLEND);
+ }
+
mv.popMatrix();
}
LifeBonus.INFLATE_TIME = 500; // time it takes for the bonus to grow from tiny to full size
+LifeBonus.REMOVE_TIME = 500; // time it takes for the bonus to be removed after it is taken
LifeBonus.prototype.advance = function(elapsed) {
LifesRenderable.prototype.rotate.call(this, elapsed);
@@ -233,8 +251,18 @@ LifeBonus.prototype.advance = function(elapsed) {
this.elapsed = Math.min(this.elapsed + elapsed, LifeBonus.INFLATE_TIME);
this.inflate = this.elapsed * (1/LifeBonus.INFLATE_TIME);
}
+ else if (this.removeElapsed != -1) {
+ this.removeElapsed = Math.min(this.removeElapsed + elapsed, LifeBonus.REMOVE_TIME);
+ var et = this.removeElapsed * (1/LifeBonus.REMOVE_TIME)
+ this.inflate = 1 + 3 * et;
+ this.alpha = 1 - et;
+ if (et >= 1) {
+ return false; // remove the bonus item.
+ }
+ }
else
this.inflate = 1;
+ return true;
}
// called when player takes this bonus
@@ -246,7 +274,8 @@ LifeBonus.prototype.action = function(player) {
for(var ni in this.occupy)
world.map.unset(this.occupy[ni]);
- delete world.bonuses[this.index];
+ //delete world.bonuses[this.index];
+ world.bonuses[this.index].startRemove()
playBonusSound(player);
c2d.addMessage(player.prettyName() + " found a life bonus");
diff --git a/src/widgets2d.js b/src/widgets2d.js
index 386f547..617b81a 100644
--- a/src/widgets2d.js
+++ b/src/widgets2d.js
@@ -135,7 +135,9 @@ function C2d() {
this.has3dContent = false;
this.render3d = []; // 3d renderables
this.mainMenu = null; // points to the function which draw the menu from which we came. either the start menu or the custom level menu
-
+ this.menuAnim = null;
+
+ // TBD - move this to the main anim func...
window.setInterval(function () { c2d.checkMessageQueue(); }, 200);
}
@@ -611,6 +613,8 @@ C2d.prototype.drawWidgets = function () {
this.wnd.draw(this.curPage.sel)
// if the selected widget has associated text, display the text win the text box
+ if (this.curPage.widgets.length == 0)
+ return // can happen if the dialog was cleared
var text = this.curPage.widgets[this.curPage.sel].text;
if (this.curPage.selTextBox && text) {
this.backgroundRect(this.curPage.selTextBox);