Skip to content

Commit 679b6c5

Browse files
committed
[+] game over trigger
1 parent 0be64f3 commit 679b6c5

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed

clean

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
jam clean
44

5+
rm -rf *.out

mod/env/credits.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ Igor Khotin
44
Anatolii Yakushko
55
Oleksii Natoloka
66
Liliia Natoloka
7+
Mark Khotin
78

mod/lab/hud/statCalc.js

+4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ function calcStat() {
4040
lab.hud.info.set('food', `${food}`)
4141
lab.hud.info.set('waste', `${waste}`)
4242
lab.hud.info.set('biomass', `${hp + foodHP}`)
43+
44+
let aliveTeams = 0
4345
teams.forEach(team => {
4446
if (team.cells > 0 || lab.hud.info.isSet(team.name)) {
4547
lab.hud.info.set(team.name, '' + team.cells + '/' + team.hp, team.icon)
4648
}
49+
if (team.cells > 0) aliveTeams ++
4750
})
51+
if (aliveTeams === 1) trap('gameOver')
4852
}
4953

5054
function evo(dt) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const gameOverLabel = {
2+
DNA: 'hud/Label',
3+
font: env.style.font.title.head,
4+
textColor: env.style.color.title,
5+
text: 'GAME OVER',
6+
}
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const gameoverLabel = {
2+
DNA: 'hud/Label',
3+
font: env.style.font.title.head,
4+
textColor: env.style.color.title,
5+
text: 'GAME OVER',
6+
}

mod/trap/gameOver.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function gameOver() {
2+
lab.control.screen.transitTo('gameOver', {
3+
next: function() {
4+
//log('fading out from pond')
5+
trap('newGame')
6+
}
7+
})
8+
}

0 commit comments

Comments
 (0)