Add autoplay mode

This commit is contained in:
LoveEevee
2018-08-28 02:56:31 +03:00
parent 97eee0e27a
commit 2f717614fb
9 changed files with 100 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
function Controller(selectedSong, songData){
function Controller(selectedSong, songData, autoPlayEnabled){
var _this = this;
var _backgroundURL = "/songs/"+selectedSong.folder+"/bg.png";
@@ -8,6 +8,7 @@ function Controller(selectedSong, songData){
var _game = new Game(this, selectedSong, _songData);
var _view = new View(this, _backgroundURL, selectedSong.title, selectedSong.difficulty);
var _mekadon = new Mekadon(this, _game);
var _keyboard = new Keyboard(this);
var _mainLoop;
var _pauseMenu = false;
@@ -165,6 +166,10 @@ function Controller(selectedSong, songData){
return _keyboard.getKeys();
}
this.setKey = function(keyCode, down){
return _keyboard.setKey(keyCode, down);
}
this.getSongData = function(){
return _game.getSongData();
}
@@ -209,4 +214,13 @@ function Controller(selectedSong, songData){
_game.updateGlobalScore(score);
}
this.autoPlay = function(circle){
if(autoPlayEnabled){
if(circle && circle.getStatus() == 450){
_mekadon.play(circle)
}
return true
}
}
}