Lots of gameplay improvements

This commit is contained in:
LoveEevee
2018-09-05 19:46:26 +03:00
parent 2405345291
commit 79c4cfcd9d
11 changed files with 738 additions and 637 deletions

View File

@@ -13,6 +13,10 @@ function Keyboard(controller){
var _waitKeyupScore = {};
var _waitKeyupSound = {};
var _waitKeyupMenu = {};
var _keyTime = {
"don": -Infinity,
"ka": -Infinity
}
this.getBindings = function(){
return _kbd
@@ -54,10 +58,10 @@ function Keyboard(controller){
if(!controller.autoPlayEnabled){
_gamepad.play()
}
_this.checkKeySound(_kbd["don_l"], "note_don")
_this.checkKeySound(_kbd["don_r"], "note_don")
_this.checkKeySound(_kbd["ka_l"], "note_ka")
_this.checkKeySound(_kbd["ka_r"], "note_ka")
_this.checkKeySound(_kbd["don_l"], "don")
_this.checkKeySound(_kbd["don_r"], "don")
_this.checkKeySound(_kbd["ka_l"], "ka")
_this.checkKeySound(_kbd["ka_r"], "ka")
}
this.checkMenuKeys = function(){
@@ -80,7 +84,8 @@ function Keyboard(controller){
this.checkKeySound = function(keyCode, sound){
_this.checkKey(keyCode, "sound", function(){
controller.playSound(sound);
controller.playSound("note_"+sound);
_keyTime[sound] = controller.getEllapsedTime().ms
})
}
@@ -112,5 +117,9 @@ function Keyboard(controller){
else if(type == "sound") _waitKeyupSound[key] = true;
else if(type == "menu") _waitKeyupMenu[key] = true;
}
this.getKeyTime = function(){
return _keyTime;
}
}