end level
This commit is contained in:
parent
12afa0ce78
commit
6d77ee84f1
|
@ -4,7 +4,7 @@ Theme: Cosmic
|
||||||
Limitation: the player must cheat
|
Limitation: the player must cheat
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- [ ] game over & restart
|
- [X] game over & restart
|
||||||
- [ ] sound effects
|
- [ ] sound effects
|
||||||
- [ ] background music
|
- [ ] background music
|
||||||
- [X] score overlay
|
- [X] score overlay
|
||||||
|
|
54
chi-tor.wren
54
chi-tor.wren
|
@ -287,7 +287,7 @@ class World {
|
||||||
_world_x = 0
|
_world_x = 0
|
||||||
_world_y = 0
|
_world_y = 0
|
||||||
_w_offset_x = 0
|
_w_offset_x = 0
|
||||||
_world_scroll_speed = 60 / 3
|
_world_scroll_speed = 60 / 5
|
||||||
_hint_planet_i = 0
|
_hint_planet_i = 0
|
||||||
|
|
||||||
// init background
|
// init background
|
||||||
|
@ -370,11 +370,13 @@ class World {
|
||||||
|
|
||||||
// Map scrolling
|
// Map scrolling
|
||||||
if (Game.state == Game.game) {
|
if (Game.state == Game.game) {
|
||||||
|
if (_world_x < 210) {
|
||||||
if (_t % _world_scroll_speed == 0) {
|
if (_t % _world_scroll_speed == 0) {
|
||||||
_world_x = _world_x + 1
|
_world_x = _world_x + 1
|
||||||
}
|
}
|
||||||
_w_offset_x = -(_t % _world_scroll_speed) / (_world_scroll_speed / 8)
|
_w_offset_x = -(_t % _world_scroll_speed) / (_world_scroll_speed / 8)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_player.alive) {
|
if (_player.alive) {
|
||||||
_t = _t + 1
|
_t = _t + 1
|
||||||
|
@ -504,6 +506,7 @@ class Game is TIC{
|
||||||
_p_index = 0
|
_p_index = 0
|
||||||
_c_index = 0
|
_c_index = 0
|
||||||
__score = 0
|
__score = 0
|
||||||
|
_t_delay = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
TIC() {
|
TIC() {
|
||||||
|
@ -522,17 +525,19 @@ class Game is TIC{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game.state == Game.gameover) {
|
if (Game.state == Game.gameover) {
|
||||||
|
if (_t_delay > 10) {
|
||||||
var h = 40
|
var h = 40
|
||||||
TIC.rect(0, (H - h) / 2, W, h, Color.red)
|
TIC.rect(0, (H - h) / 2, W, h, Color.red)
|
||||||
TIC.print("GAME OVER", 70, H/2-10, Color.white, true, 2)
|
TIC.print("GAME OVER", 70, H/2-10, Color.white, true, 2)
|
||||||
TIC.print("press Z to restart", 90, H/2+8, Color.white, false, 1, true)
|
TIC.print("press Z to restart", 90, H/2+8, Color.white, false, 1, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
if (Game.state == Game.title) {
|
if (Game.state == Game.title) {
|
||||||
if (TIC.btnp(4)) {
|
if (TIC.btnp(4)) {
|
||||||
__state = Game.game
|
newGame()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (Game.state == Game.game) {
|
} else if (Game.state == Game.game) {
|
||||||
|
@ -543,10 +548,12 @@ class Game is TIC{
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (Game.state == Game.gameover) {
|
} else if (Game.state == Game.gameover) {
|
||||||
|
if (_t_delay > 10) {
|
||||||
if (TIC.btnp(4)) {
|
if (TIC.btnp(4)) {
|
||||||
_world = World.new()
|
newGame()
|
||||||
__state = Game.game
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_t_delay = _t_delay + 1
|
||||||
|
|
||||||
|
|
||||||
} else if (Game.state == Game.pause) {
|
} else if (Game.state == Game.pause) {
|
||||||
|
@ -575,6 +582,13 @@ class Game is TIC{
|
||||||
_world.update()
|
_world.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newGame() {
|
||||||
|
_world = World.new()
|
||||||
|
__state = Game.game
|
||||||
|
__score = 0
|
||||||
|
_t_delay = 0
|
||||||
|
}
|
||||||
|
|
||||||
cheatFound() {
|
cheatFound() {
|
||||||
var end = _p_index
|
var end = _p_index
|
||||||
var start = (end - Cheat.seq.count)
|
var start = (end - Cheat.seq.count)
|
||||||
|
@ -687,22 +701,22 @@ class Game is TIC{
|
||||||
// </SPRITES>
|
// </SPRITES>
|
||||||
|
|
||||||
// <MAP>
|
// <MAP>
|
||||||
// 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060606060606060606060606060606060606060606060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060606060606060606060606060606060606060606060
|
// 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060606060606060606060606060606060606060606060000000000000000000000000000000000000000000000000000000000000606060606060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060606060606060606060606060606060606060606060
|
||||||
// 001:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 001:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606060606060606060600000000000000000000000000000000000000000000000000000000000000000000060606060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 002:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 002:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060000000000000001200000000000000000000000000000000000000000000000000000000006060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 003:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000006060606060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 003:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000006060606060606000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 004:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 004:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060600000000000000000000000000000000000000000000000120000000000000000000000000000000000000060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 005:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 005:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 006:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 006:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 007:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 007:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 008:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 008:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000001200000000000060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 009:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 009:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 010:000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 010:000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000006060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 011:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 011:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 012:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 012:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 013:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 013:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000006060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 014:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006060000000000000000060600000000000000000000000606060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 014:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006060000000000000000060600000000000000000000000606060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060606060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 015:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060600000000000006060606000000000000000006060606060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
// 015:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060600000000000006060606000000000000000006060606060606000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000606060606060606060606060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
// 016:000000000000000000000000000000000000000000000000000000000000606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
|
// 016:000000000000000000000000000000000000000000000000000000000000606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060
|
||||||
// </MAP>
|
// </MAP>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue