Added a new level property: Difficulty
* An enum ranging from -1, 0, 1 (Peaceful, Normal, Hard)
* Default difficulty is Normal; pre-existing levels are Normal by
default per the zero value.
Doodad scripts can read the difficulty via the new global variable
`Level.Difficulty` and some doodads have been updated:
* Azulians: on Peaceful they ignore all player characters, and on Hard
they are in "hunt mode": infinite aggro radius and they're aggressive
to all characters.
* Bird: on Peaceful they will not dive and attack any player character.
Other spit and polish:
* New Level/Level Properties UI reworked into a magicform.
* New "PromptPre(question, answer, func)" function for prompting the
user with the developer shell, but pre-filling in an answer for them
to either post or edit.
* magicform has a PromptUser field option for simple Text/Int fields
which present as buttons, so magicform can prompt and update the
variable itself.
* Don't show the _autosave.doodad in the Doodad Dropper window.
* Switch from otto to goja for JavaScript engine.
* goja supports many ES6 syntax features like arrow functions,
const/let, for-of with more coming soon.
* Same great features as otto, more modern environment for doodads!
* The "Giant Screenshot" feature takes a very long time, so it is made
asynchronous. If you try and run a second one while the first is busy,
you get an error flash. You can continue editing the level, even
playtest it, or load a different level, and it will continue crunching
on the Giant Screenshot and flash when it's finished.
* Updated the player physics to use proper Velocity to jump off the
ground rather than the hacky timer-based fixed speed approach.
* FlashError() function to flash "error level" messages to the screen.
They appear in orange text instead of the usual blue, and most error
messages in the game use this now. The dev console "error <msg>"
command can simulate an error message.
* Flashed message fonts are updated. The blue font now uses softer
stroke and shadow colors and the same algorithm applies to the orange
error flashes.
Some other changes to player physics:
* Max velocity, acceleration speed, and gravity have been tweaked.
* Fast turn-around if you are moving right and then need to go left.
Your velocity resets to zero at the transition so you quickly get
going the way you want to go.
Some levels that need a bit of love for the new platforming physics:
* Tutorial 3.level
The Checkpoint Region acts as an invisible checkpoint flag, remembering
the player's location should they need to respawn there.
New cheat: `show all actors` during Play Mode will make every hidden
actor visible. Useful to see your technical doodads during gameplay!
Developer shell: `Execute(command string)` is available to the
JavaScript interpreter. It simulates another command being run on the
developer console.
* pkg/loadscreen implements a global Loading Screen for loading heavy
levels for playing or editing.
* All chunks in a level are pre-rendered to bitmap before gameplay
begins, which reduces stutter as chunks were being lazily rendered on
first appearance before.
* The loading screen can be played with in the developer console:
$ loadscreen.Show()
$ loadscreen.Hide()
Along with ShowWithProgress(), SetProgress(float64) and IsActive()
* Chunker: separate the concerns between Bitmaps an (SDL2) Textures.
* Chunker.Prerender() converts a chunk to a bitmap (a Go image.Image)
and caches it, only re-rendering if marked as dirty.
* Chunker.Texture() will use the pre-cached bitmap if available to
immediately produce the SDL2 texture.
Other miscellaneous changes:
* Added to the Colored Pencil palette: Sandstone
* Added "perlin noise" brush pattern
Note: this commit introduces instability and crashes:
* New `asyncSetup()` functions run on a goroutine, but SDL2 texture
calls must run on the main thread.
* Chunker avoids this by caching bitmaps, not textures.
* Wallpaper though is unstable, sometimes works, sometimes has graphical
glitches, sometimes crashes the game.
* Wallpaper.Load() and the *Texture() functions are where it crashes.
* Holding Shift while pressing arrow keys in the editor will scroll by
just 1 pixel per tick to aid in precise debugging with the Zoom In/Out
feature.
* The keybinds used in canvas_editable.go to catch the arrow keys are
updated to use our nice keybind package. As a consequence, the WASD
keys will also scroll the level.
* The "d for Doodads" keybind is renamed "q" so as not to open the
Doodads window whenever scrolling right using the WASD keys.
* File->Publish Level in the Level Editor opens the Publish window,
where you can embed custom doodads into your level and export a
portable .level file you can share with others.
* Currently does not actually export a level file yet.
* The dialog lists all unique doodad names in use in your level, and
designates which are built-ins and which are custom (paginated).
* A checkbox would let the user embed built-in doodads into their level,
as well, locking it in to those versions and not using updated
versions from future game releases.
UI Improvements:
* Added styling for a "Primary" UI button, rendered in deep blue.
* Pop-up modals (Alert, Confirm) color their Ok button as Primary.
* The Enter key pressed during an Alert or Confirm modal will invoke its
default button and close the modal, corresponding to its Primary
button.
* The developer console is now opened with the tilde/grave key ` instead
of the Enter key, so that the Enter key is free to click through
modals.
* In the "Open/Edit Drawing" window, a "Browse..." button is added to
the level and doodad sections, spawning a native File Open dialog to
pick a .level or .doodad outside the config root.
* The game's tick counter was moved from Doodle.ticks to shmem.Tick
where it is more easily available from every corner of the code.
* Fix a bug in the Level Editor where dragging an already-existing actor
from one part of your map to another, would cause it to lose all its
data (especially its UUID), breaking links to other doodads. Now the
existing Actor catches a ride on the drag object to be reinserted
later.
* Animate the Link Line visualizers between actors. They now animate a
blinking color between magenta and grey-ish.
* Toolbar has icon buttons for the Pencil Tool, Line Tool, Rect Tool,
Actor Tool and Link Tool.
* Remove the tab buttons from the top of the Palette window. The palette
tab is now toggled between Swatches and Doodads by the tool selected
on the tool bar, instead of the tab buttons setting the tool.
* Remove the "Link Doodads" button from the Doodad Palette. The Link
Tool has its own dedicated toolbar button with the others.