Invincibility Cheat

Add cheat `god mode` that toggles invincibility. Fire pixels and hostile
mobs can't fail the level for you.
pull/84/head
Noah 2022-01-17 22:02:27 -08:00
parent 9201475060
commit 3f7e384633
4 changed files with 70 additions and 0 deletions

View File

@ -1,5 +1,56 @@
# Changes
## v0.11.0 (TBD)
New features:
* The **JavaScript Engine** for the game has been switched from
github.com/robertkrimen/otto to github.com/dop251/goja which helps
"modernize" the experience of writing doodads. Goja supports many
common ES6 functions already, such as:
* Arrow functions
* `let` and `const` keywords
* Promises
* for-of loops
* The **JavaScript API** has been expanded with new functions and
many of the built-in Creatures have gotten an A.I. update.
* For full versions of the game, the **Publish Level** function is now
more streamlined to just a checkbox for automatically bundling your
doodads next time you save the level.
Some of the built-in doodads have updates to their A.I. and creatures
are becoming more dangerous:
* The **Bird** now searches for the player diagonally in front of
it for about 240px or so. If spotted it will dive toward you and
it is dangerous when diving!
* The **Azulians** will start to follow the player when you get
close and they are dangerous when they touch you -- but not if
you're the **Thief.** The red Azulian has a wider search radius,
higher jump and faster speed than the blue Azulian.
New functions are available on the JavaScript API for doodads:
* `Actors.At(Point) []*Actor`: returns actors intersecting a point
* `Actors.FindPlayer() *Actor`: returns the nearest player character
* `Actors.New(filename string)`: create a new actor (NOT TESTED YET!)
* `Self.Grounded() bool`: query the grounded status of current actor
New cheat code:
* `god mode`: toggle invincibility. When on, fire pixels and hostile
mobs can't make you fail the level.
Other changes:
* The draw order of actors on a level is now deterministic: the most
recently added actor will always draw on top when overlapping another,
and the player actor is always on top.
* When the game checks if there's an update available via
<https://download.sketchymaze.com/version.json> it will send a user
agent header like: "Sketchy Maze v0.10.2 on linux/amd64" sending only
static data about the version and OS.
## v0.10.1 (Jan 9 2022)
New features:

View File

@ -29,4 +29,5 @@ var (
CheatPlayAsBoy = "pinocchio"
CheatPlayAsAzuBlue = "the cell"
CheatPlayAsThief = "play as thief"
CheatGodMode = "god mode"
)

View File

@ -128,6 +128,20 @@ func (c Command) cheatCommand(d *Doodle) bool {
balance.PlayerCharacterDoodad = "thief.doodad"
d.Flash("Set default player character to Thief")
case balance.CheatGodMode:
if isPlay {
d.Flash("God mode toggled")
playScene.SetCheated()
playScene.godMode = !playScene.godMode
if playScene.godMode {
d.FlashError("God mode enabled.")
} else {
d.Flash("God mode disabled.")
}
} else {
d.FlashError("Use this cheat in Play Mode to toggle invincibility.")
}
default:
return false
}

View File

@ -69,6 +69,7 @@ type PlayScene struct {
playerLastDirection float64 // player's heading last tick
antigravity bool // Cheat: disable player gravity
noclip bool // Cheat: disable player clipping
godMode bool // Cheat: player can't die
playerJumpCounter int // limit jump length
// Inventory HUD. Impl. in play_inventory.go
@ -420,6 +421,9 @@ func (s *PlayScene) BeatLevel() {
// FailLevel handles a level failure triggered by a doodad.
func (s *PlayScene) FailLevel(message string) {
if s.godMode {
return
}
s.SetImperfect()
s.d.FlashError(message)
s.ShowEndLevelModal(