Merge pull request #33 from LoveEevee/two-animations

Add clear and endclear animations
This commit is contained in:
Bui 2018-09-26 06:04:47 +01:00 committed by GitHub
commit 74a9813c14
6 changed files with 32 additions and 13 deletions

View File

@ -1,24 +1,17 @@
@-webkit-keyframes bgscroll{
from{
background-position: 0 0;
}
to{
background-position: -200px 0;
}
}
@keyframes bgscroll{
from{
background-position: 0 0;
}
to{
background-position: -200px 0;
background-position: -30vmin 0;
}
}
#song-select{
width: 100%;
height: 100%;
background: url("/assets/img/bg-pattern-1.png");
animation: bgscroll 3s infinite linear;
background-size: 30vmin;
animation: bgscroll 8s infinite linear;
white-space: nowrap;
}
#song-container{

View File

@ -31,6 +31,8 @@ var assets = {
"don_anim_10combo.png",
"don_anim_gogo.png",
"don_anim_gogostart.png",
"don_anim_clear.png",
"don_anim_endclear.png",
"fire_anim.png",
"fireworks_anim.png"
],

View File

@ -107,6 +107,7 @@ class Controller{
this.view.togglePauseMenu()
}
gameEnded(){
this.view.gameEnded()
var score = this.getGlobalScore()
var vp
if(score.fail === 0){

View File

@ -281,7 +281,7 @@ class Game{
var ms = this.getElapsedTime().ms
if(this.musicFadeOut === 0){
if(this.controller.multiplayer === 1){
p2.send("gameresults", this.controller.getGlobalScore())
p2.send("gameresults", this.getGlobalScore())
}
this.musicFadeOut++
}else if(this.musicFadeOut === 1 && ms >= started + 1600){

View File

@ -749,7 +749,8 @@ class View{
})
}
}else{
if(this.assets.don.getAnimation() === "gogo"){
var animation = this.assets.don.getAnimation()
if(animation === "gogo" || this.controller.getGlobalScore().hp >= 50 && animation === "normal"){
this.assets.don.normalAnimation()
}
if(ms >= this.gogoTimeStarted + 100){
@ -770,10 +771,24 @@ class View{
don.setAnimation("10combo")
var ms = this.controller.getElapsedTime().ms
don.setAnimationStart(ms)
var length = don.getAnimationLength("normal")
don.setUpdateSpeed(this.beatInterval / (length / 4))
var length = don.getAnimationLength("10combo")
don.setAnimationEnd(ms + length * don.speed, don.normalAnimation)
}
}
gameEnded(){
if(this.controller.getGlobalScore().hp >= 50){
var don = this.assets.don
don.setAnimation("endclear")
var ms = this.controller.getElapsedTime().ms
don.setAnimationStart(ms)
var length = don.getAnimationLength("normal")
don.setUpdateSpeed(this.beatInterval / (length / 4))
var length = don.getAnimationLength("endclear")
don.setAnimationEnd(ms + length * don.speed, don.normalAnimation)
}
}
onmousemove(event){
this.lastMousemove = this.controller.getElapsedTime().ms
this.cursorHidden = false

View File

@ -42,12 +42,20 @@ class ViewAssets{
var length = this.don.getAnimationLength("gogo")
this.don.setUpdateSpeed(this.beatInterval / (length / 4))
this.don.setAnimation("gogo")
}else if(this.controller.getGlobalScore().hp >= 50){
this.don.setAnimationStart(0)
var length = this.don.getAnimationLength("clear")
this.don.setUpdateSpeed(this.beatInterval / (length / 2))
this.don.setAnimation("clear")
}else{
this.don.setAnimationStart(0)
this.don.setUpdateSpeed(this.beatInterval / 16)
var length = this.don.getAnimationLength("normal")
this.don.setUpdateSpeed(this.beatInterval / (length / 4))
this.don.setAnimation("normal")
}
}
this.don.addFrames("clear", 30, "don_anim_clear")
this.don.addFrames("endclear", 22, "don_anim_endclear")
this.don.normalAnimation()
this.fire = this.createAsset("bar", frame => {
var imgw = 360