diff --git a/docs/assets/js/UI/ui.js b/docs/assets/js/UI/ui.js index 356da0b..c87fa14 100644 --- a/docs/assets/js/UI/ui.js +++ b/docs/assets/js/UI/ui.js @@ -26,13 +26,22 @@ function drawPlayingUI() { switch(tutState) { case tutorialStates.getCereal: - text("Objective: eat breakfast",10,ch-30,"black",2); + curCtx.globalAlpha = 0.5; + rect(150,ch-15,300,30,"white"); + curCtx.globalAlpha = 1; + text("Objective: eat breakfast",10,ch-25,"black",2); break; case tutorialStates.getMail: - text("Objective: bring in the mail",10,ch-30,"black",2); + curCtx.globalAlpha = 0.5; + rect(170,ch-15,340,30,"white"); + curCtx.globalAlpha = 1; + text("Objective: bring in the mail",10,ch-25,"black",2); break; case tutorialStates.goToBed: - text("Objective: go back to bed",10,ch-30,"black",2); + curCtx.globalAlpha = 0.5; + rect(150,ch-15,300,30,"white"); + curCtx.globalAlpha = 1; + text("Objective: go back to bed",10,ch-25,"black",2); break; } diff --git a/docs/assets/js/constants.js b/docs/assets/js/constants.js index 35aaf37..025fddf 100644 --- a/docs/assets/js/constants.js +++ b/docs/assets/js/constants.js @@ -60,7 +60,7 @@ var constants = { offset_y: 35 }, defaultX: 575, - defaultY: -150 + defaultY: -155 } }; \ No newline at end of file diff --git a/docs/assets/js/playing/objective.js b/docs/assets/js/playing/objective.js index d6fb7a8..88d8974 100644 --- a/docs/assets/js/playing/objective.js +++ b/docs/assets/js/playing/objective.js @@ -15,6 +15,9 @@ Objective.prototype.draw = function() { Objective.prototype.update = function() { if(rectrect(this,player)) { + for(var j=0;j<50;j++) { + Particles.push(new Particle(this.x,this.y)); + } this.callback(); return true; } diff --git a/docs/assets/js/playing/particles.js b/docs/assets/js/playing/particles.js new file mode 100644 index 0000000..c564e41 --- /dev/null +++ b/docs/assets/js/playing/particles.js @@ -0,0 +1,42 @@ +class Particle { + constructor(x,y) { + this.x = x; + this.y = y; + this.size = rand(2,8); + var angle = rand(0,2262)/360; + var speed = rand(5,10); + this.vel = {x:Math.cos(angle) * speed,y:Math.sin(angle) * speed}; + this.timer = rand(25,50); + } +} + +Particle.prototype.draw = function() { + rect(this.x,this.y,this.size,this.size,"#baba30"); +} + +Particle.prototype.update = function() { + if(this.timer <= 0) { + return true; + } + --this.timer; + this.x += this.vel.x; + this.y += this.vel.y; + this.vel.y += 0.1; + return false; +} + +var Particles = []; +function updateParticles() { + for(var i=0;i 560) { - + globalState = globalStates.end; } break; } @@ -81,6 +81,7 @@ function handlePlaying() { } updateLife(); + updateParticles(); updateObjectives(); } @@ -95,6 +96,9 @@ function drawPlaying() { if(boxOnTable) { imgIgnoreCutoff(sprites.boxNoOutline,-140,116,0,4,4); } + + drawParticles(); + // drawWorldBlocks(); player.draw(); diff --git a/docs/index.html b/docs/index.html index 9abf881..83f66b0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -72,6 +72,7 @@ Matthew West +