Cheat: $ d.SetPlayerCharacter("anything.doodad")

Too restricted by the cheat codes to play as certain characters
on-demand? Use the JS shell in the developer console to set any doodad
you want:

    $ d.SetPlayerCharacter("key-blue")
    $ d.SetPlayerCharacter("anvil")
    $ d.SetPlayerCharacter("box.doodad")

The .doodad suffix is optional.

Interesting behaviors when playing as odd doodads:

* Most non-mobile doodads don't collide with each other, so you can pass
  through doors and not activate buttons if you play as a key or a
  trapdoor. Non-mobile doodads also generally have antigravity so you
  can fly freely around the map.
* Non-mobile doodads can not open Warp Doors or interact with the Exit
  Flag. You'll have to change back to a creature such as "boy" or
  "azu-blue" to win the level.
* If you are a key, the Thief can collect you! This removes your player
  doodad from the level and soft locks the game. No worries, another
  call to d.SetPlayerCharacter() will put you back on the map!
* If the doodad name isn't found, you'll play as the built-in fallback
  doodad, which is just a red "X" shape. It has anti-gravity and does
  not generally interact with any doodad (can not push buttons or
  collect keys - but it can pass through doors and other obstacles. Can
  not win the level goal flag, though!)
This commit is contained in:
Noah 2022-04-29 21:27:07 -07:00
parent 93623e4e8a
commit 302506eda9

View File

@ -10,6 +10,17 @@ import (
// IsDefaultPlayerCharacter checks whether the DefaultPlayerCharacter doodad has // IsDefaultPlayerCharacter checks whether the DefaultPlayerCharacter doodad has
// been modified // been modified
// SetPlayerCharacter -- this is designed to be called in-game with the developer
// console. Sets your player character to whatever doodad you want, not just the
// few that have cheat codes. If you set an invalid filename, you become the
// dummy default doodad sprite (a red "X").
func (d *Doodle) SetPlayerCharacter(filename string) {
balance.PlayerCharacterDoodad = filename
if playScene, isPlay := d.Scene.(*PlayScene); isPlay {
playScene.SetPlayerCharacter(balance.PlayerCharacterDoodad)
}
}
// cheatCommand is a subroutine of the Command.Run() method of the Doodle // cheatCommand is a subroutine of the Command.Run() method of the Doodle
// developer shell (commands.go). It looks for special cheat codes entered // developer shell (commands.go). It looks for special cheat codes entered
// into the command shell and executes them. // into the command shell and executes them.