Commit e6b39a21 authored by Manuel Tondeur's avatar Manuel Tondeur Committed by Johnny Jazeix
Browse files

gnumch activities, add level change

parent 5b7164e7
......@@ -59,24 +59,26 @@ ActivityBase {
}
function nextLevel() {
Activity.nextLevel()
if (Activity._currentLevel == 7) {
operator = " - "
Activity._operator = operator
}
Activity.nextLevel();
initLevel();
}
if (Activity._currentLevel == 0) {
operator = " + "
}
topPanel.goal = Activity.getGoal()
monsters.destroyAll()
Activity.fillAllGrid()
topPanel.life.opacity = 1
spawningMonsters.stop()
timerActivateWarn.stop()
if (Activity._currentLevel != 7) {
spawningMonsters.start()
timerActivateWarn.start()
function previousLevel() {
Activity.previousLevel();
initLevel();
}
function initLevel() {
topPanel.life.opacity = 1;
forceActiveFocus();
Activity.initLevel();
operator = Activity._operator;
topPanel.goal = Activity.getGoal();
monsters.destroyAll();
spawningMonsters.stop();
timerActivateWarn.stop();
if (Activity._currentLevel % 6 !== 0) {
spawningMonsters.restart();
}
}
......@@ -91,19 +93,8 @@ ActivityBase {
}
onStart: {
Activity.start(modelCells, topPanel.bar, bonus, type, operator)
topPanel.life.opacity = 1
forceActiveFocus()
operator = " + "
Activity._operator = operator
Activity.fillAllGrid()
topPanel.goal = Activity.getGoal()
if (Activity._currentLevel % 6 == 1) {
spawningMonsters.restart()
} else {
spawningMonsters.stop()
timerActivateWarn.stop()
}
Activity.start(modelCells, topPanel.bar, bonus, type, operator);
initLevel();
}
onStop: {
monsters.destroyAll()
......
......@@ -99,11 +99,11 @@ Rectangle {
id: bar
content: BarEnumContent {
value: help | home
value: help | home | level
}
onHelpClicked: displayDialog(dialogHelp)
onPreviousLevelClicked: Activity.previousLevel()
onNextLevelClicked: Activity.nextLevel()
onPreviousLevelClicked: background.previousLevel()
onNextLevelClicked: background.nextLevel()
onHomeClicked: activity.home()
}
}
......@@ -46,8 +46,14 @@ function start(modelCells, bar, bonus, type, operator) {
function stop() {
}
function initLevel() {
_operator = _currentLevel < 7 ? " + " : " - ";
fillAllGrid();
_bar.level = _currentLevel + 1;
}
function nextLevel() {
if(_numberOfLevel <= ++_currentLevel ) {
if(_numberOfLevel <= ++_currentLevel) {
_currentLevel = 0
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment