Browse Source

add no collision cheat

master html_5
Fabien Freling 5 months ago
parent
commit
dd44b3ad38
  1. 4
      README.md
  2. 33
      chi-tor.wren

4
README.md

@ -11,8 +11,8 @@ Limitation: the player must cheat
- [X] stage 1
- [X] stage ending
- [X] win state
- [ ] update itch page
- [ ] other cheats?
- [X] update itch page
- [X] other cheats?
- [ ] explicit goal?
- [X] bug: respawn killed enemies
- [ ] bug: bullets collide with bg?

33
chi-tor.wren

@ -56,6 +56,9 @@ class Cheat {
static doublePoints { __double_points }
static doublePoints=(b) { __double_points = b }
static noCollision { __no_collision }
static noCollision=(b) { __no_collision = b }
}
class Star {
@ -419,7 +422,7 @@ class World {
}
}
if (_player.alive) {
if (_player.alive && !Cheat.noCollision) {
var bx = _player.x - _player.bw / 2
var by = _player.y - _player.bh / 2
if (!(fgCheck(bx, by) &&
@ -602,8 +605,19 @@ class Game is TIC{
Cheat.enabled = true
}
} else {
if (TIC.btnp(D.up)) {
_c_index = (_c_index-1).clamp(0, 1)
}
if (TIC.btnp(D.down)) {
_c_index = (_c_index+1).clamp(0, 1)
}
if (TIC.btnp(4)) {
Cheat.doublePoints = !Cheat.doublePoints
if (_c_index == 0) {
Cheat.doublePoints = !Cheat.doublePoints
}
if (_c_index == 1) {
Cheat.noCollision = !Cheat.noCollision
}
}
}
}
@ -666,14 +680,25 @@ class Game is TIC{
TIC.spr(sprId, 5 + pos * 10, H - 20, 0, 1, 0, rot)
}
} else {
var h = H/4 + 20
TIC.spr(116, 50, h - 1, 0)
var h = H/4 + 30
TIC.spr(116, 50, (h + _c_index * 16) - 1, 0)
TIC.print("double points:", 60, h, Color.white)
if (Cheat.doublePoints) {
TIC.print("ON", 140, h, Color.green)
} else {
TIC.print("OFF", 140, h, Color.red)
}
h = h + 16
TIC.print("no collision:", 60, h, Color.white)
if (Cheat.noCollision) {
TIC.print("ON", 140, h, Color.green)
} else {
TIC.print("OFF", 140, h, Color.red)
}
TIC.print("debug mode: enabled", 60, H - 10, Color.white)
}
}

Loading…
Cancel
Save