doodle/pkg/balance/theme.go

347 lines
8.0 KiB
Go
Raw Permalink Normal View History

package balance
import (
2022-09-24 22:17:25 +00:00
magicform "git.kirsle.net/SketchyMaze/doodle/pkg/uix/magic-form"
"git.kirsle.net/go/render"
"git.kirsle.net/go/ui"
"git.kirsle.net/go/ui/style"
)
// Theme and appearance variables.
var (
2022-01-03 00:28:43 +00:00
// Sprite filenames.
WindowIcon = "assets/icons/96.png"
2022-01-03 00:28:43 +00:00
GoldCoin = "assets/sprites/gold.png"
SilverCoin = "assets/sprites/silver.png"
LockIcon = "assets/sprites/padlock.png"
Doodad/Actor Runtime Options * Add "Options" support for Doodads: these allow for individual Actor instances on your level to customize properties about the doodad. They're like "Tags" except the player can customize them on a per-actor basis. * Doodad Editor: you can specify the Options in the Doodad Properties window. * Level Editor: when the Actor Tool is selected, on mouse-over of an actor, clicking on the gear icon will open a new "Actor Properties" window which shows metadata (title, author, ID, position) and an Options tab to configure the actor's options. Updates to the scripting API: * Self.Options() returns a list of option names defined on the Doodad. * Self.GetOption(name) returns the value for the named option, or nil if neither the actor nor its doodad have the option defined. The return type will be correctly a string, boolean or integer type. Updates to the doodad command-line tool: * `doodad show` will print the Options on a .doodad file and, when showing a .level file with --actors, prints any customized Options with the actors. * `doodad edit-doodad` adds a --option parameter to define options. Options added to the game's built-in doodads: * Warp Doors: "locked (exit only)" will make it so the door can not be opened by the player, giving the "locked" message (as if it had no linked door), but the player may still exit from the door if sent by another warp door. * Electric Door & Electric Trapdoor: "opened" can make the door be opened by default when the level begins instead of closed. A switch or a button that removes power will close the door as normal. * Colored Doors & Small Key Door: "unlocked" will make the door unlocked at level start, not requiring a key to open it. * Colored Keys & Small Key: "has gravity" will make the key subject to gravity and set its Mobile flag so that if it falls onto a button, it will activate. * Gemstones: they had gravity by default; you can now uncheck "has gravity" to remove their Gravity and IsMobile status. * Gemstone Totems: "has gemstone" will set the totem to its unlocked status by default with the gemstone inserted. No power signal will be emitted; it is cosmetic only. * Fire Region: "name" can let you set a name for the fire region similarly to names for fire pixels: "Watch out for ${name}!" * Invisible Warp Door: "locked (exit only)" added as well.
2022-10-10 00:41:24 +00:00
GearIcon = "assets/sprites/gear.png"
// Cursors
CursorIcon = "assets/sprites/pointer.png"
PencilIcon = "assets/sprites/pencil.png"
FloodCursor = "assets/sprites/flood-cursor.png"
// Pixel attributes
AttrSolid = "assets/sprites/attr-solid.png"
AttrFire = "assets/sprites/attr-fire.png"
AttrWater = "assets/sprites/attr-water.png"
AttrSemiSolid = "assets/sprites/attr-semisolid.png"
AttrSlippery = "assets/sprites/attr-slippery.png"
// Title Screen Font
TitleScreenFont = render.Text{
Size: 46,
Color: render.Pink,
Stroke: render.SkyBlue,
Shadow: render.Black,
}
TitleScreenSubtitleFont = render.Text{
FontFilename: SansSerifFont,
Size: 18,
Color: render.SkyBlue,
Shadow: render.SkyBlue.Darken(128),
// Color: render.RGBA(255, 153, 0, 255),
// Shadow: render.RGBA(200, 80, 0, 255),
}
TitleScreenVersionFont = render.Text{
Size: 14,
Color: render.Grey,
Shadow: render.Black,
}
// Loading Screen fonts.
LoadScreenFont = render.Text{
Size: 46,
Color: render.Pink,
Stroke: render.SkyBlue,
Shadow: render.Black,
}
LoadScreenSecondaryFont = render.Text{
FontFilename: SansSerifFont,
Size: 18,
Color: render.SkyBlue,
Shadow: render.SkyBlue.Darken(128),
// Color: render.RGBA(255, 153, 0, 255),
// Shadow: render.RGBA(200, 80, 0, 255),
}
// Play Mode Touch UI Hints Font
TouchHintsFont = render.Text{
FontFilename: SansSerifFont,
Size: 14,
Color: render.SkyBlue,
Shadow: render.SkyBlue.Darken(128),
Padding: 8,
PadY: 12,
}
// Window and panel styles.
TitleConfig = ui.Config{
Background: render.MustHexColor("#FF9900"),
OutlineSize: 1,
OutlineColor: render.Black,
}
TitleFont = render.Text{
FontFilename: SansBoldFont,
Size: 9,
Padding: 4,
Color: render.White,
Stroke: render.Red,
}
WindowBackground = render.MustHexColor("#cdb689")
WindowBorder = render.Grey
// Developer Shell and Flashed Messages styles.
FlashStrokeDarken = 60
FlashShadowDarken = 120
FlashFont = func(text string) render.Text {
return render.Text{
Text: text,
Size: 18,
Color: render.SkyBlue,
Stroke: render.SkyBlue.Darken(FlashStrokeDarken),
Shadow: render.SkyBlue.Darken(FlashShadowDarken),
}
}
FlashErrorColor = render.MustHexColor("#FF9900")
// Menu bar styles.
MenuBackground = render.Black
MenuFont = render.Text{
Size: 12,
PadX: 4,
PadY: 2,
}
MenuFontBold = render.Text{
FontFilename: SansBoldFont,
Size: 12,
PadX: 4,
}
// TabFrame styles.
TabFont = render.Text{
Size: 12,
PadX: 8,
PadY: 4,
}
// Pager styles.
PagerLargeFont = render.Text{
FontFilename: SansBoldFont,
Size: 14,
PadX: 6,
PadY: 4,
}
// Modal backdrop color.
ModalBackdrop = render.RGBA(1, 1, 1, 42)
// StatusFont is the font for the status bar.
StatusFont = render.Text{
Size: 12,
Padding: 4,
Color: render.Black,
}
// UIFont is the main font for UI labels.
UIFont = render.Text{
Size: 12,
Padding: 4,
Color: render.Black,
}
// DangerFont is a red version of UIFont.
DangerFont = render.Text{
Size: 12,
Padding: 4,
Color: render.Red,
}
// LabelFont is the font for strong labels in UI.
LabelFont = render.Text{
Size: 12,
FontFilename: SansBoldFont,
Padding: 4,
Color: render.Black,
}
2022-01-03 00:28:43 +00:00
// A New Record! Label (Gold/Perfect and Silver/Normal)
NewRecordPerfectFont = LabelFont.Update(render.Text{
Color: render.Yellow,
Stroke: render.Orange,
})
NewRecordFont = LabelFont.Update(render.Text{
Color: render.White,
Stroke: render.Grey,
})
LargeLabelFont = render.Text{
Size: 18,
FontFilename: SansBoldFont,
Padding: 4,
Color: render.Black,
}
// SmallMonoFont for cramped spaces like the +/- buttons on Toolbar.
SmallMonoFont = render.Text{
Size: 14,
PadX: 3,
FontFilename: MonospaceFont,
Color: render.Black,
}
// CodeLiteralFont for rendering <code>-like text.
CodeLiteralFont = render.Text{
Size: 11,
PadX: 3,
FontFilename: MonospaceFont,
Color: render.Magenta,
}
// ExceptionFont for showing JavaScript errors to the user.
ExceptionFont = render.Text{
Size: 12,
PadX: 3,
FontFilename: MonospaceFont,
Color: render.Black,
}
// Small font
SmallFont = render.Text{
Size: 10,
Padding: 2,
Color: render.Black,
}
// Color for draggable doodad.
DragColor = render.MustHexColor("#0099FF")
// Link lines drawn between connected doodads.
LinkLineColor = render.Magenta
LinkLighten = 128
LinkAnimSpeed uint64 = 30 // ticks
PlayButtonFont = render.Text{
FontFilename: SansBoldFont,
Size: 16,
Padding: 4,
Color: render.RGBA(255, 255, 0, 255),
Stroke: render.RGBA(100, 100, 0, 255),
}
2022-01-03 00:28:43 +00:00
// In-game level timer font.
TimerFont = render.Text{
FontFilename: MonospaceFont,
2022-01-03 00:28:43 +00:00
Size: 16,
Color: render.Cyan,
Stroke: render.DarkCyan,
}
// Doodad Dropper Window settings.
DoodadButtonBackground = render.RGBA(255, 255, 200, 255)
DoodadButtonSize = 64
DoodadDropperCols = 6 // rows/columns of buttons
DoodadDropperRows = 3
// CheatsMenu window settings.
CheatsMenuBackground = render.RGBA(0, 153, 153, 255)
// Button styles, customized in init().
ButtonPrimary = style.DefaultButton
ButtonDanger = style.DefaultButton
ButtonBabyBlue = style.DefaultButton
ButtonPink = style.DefaultButton
ButtonLightRed = style.DefaultButton
DefaultCrosshairColor = render.RGBA(0, 153, 255, 255)
// Default built-in wallpapers.
Wallpapers = []magicform.Option{
{
Label: "Notebook",
Value: "notebook.png",
},
{
Label: "Legal Pad",
Value: "legal.png",
},
{
Label: "Graph paper",
Value: "graph.png",
},
{
Label: "Dotted paper",
Value: "dots.png",
},
{
Label: "Dotted paper (dark)",
Value: "dots-dark.png",
},
{
Label: "Blueprint",
Value: "blueprint.png",
},
{
Label: "Red parchment",
Value: "red-parchment.png",
},
{
Label: "Green parchment",
Value: "green-parchment.png",
},
{
Label: "Blue parchment",
Value: "blue-parchment.png",
},
{
Label: "Yellow parchment",
Value: "yellow-parchment.png",
},
{
Label: "White parchment",
Value: "white-parchment.png",
},
{
Label: "Pure white",
Value: "white.png",
},
Update savegame format, Allow out-of-bounds camera Updates the savegame.json file format: * Levels now have a UUID value assigned at first save. * The savegame.json will now track level completion/score based on UUID, making it robust to filename changes in either levels or levelpacks. * The savegame file is auto-migrated on startup - for any levels not found or have no UUID, no change is made, it's backwards compatible. * Level Properties window adds an "Advanced" tab to show/re-roll UUID. New JavaScript API for doodad scripts: * `Actors.CameraFollowPlayer()` tells the camera to return focus to the player character. Useful for "cutscene" doodads that freeze the player, call `Self.CameraFollowMe()` and do a thing before unfreezing and sending the camera back to the player. (Or it will follow them at their next directional input control). * `Self.MoveBy(Point(x, y int))` to move the current actor a bit. New option for the `doodad` command-line tool: * `doodad resave <.level or .doodad>` will load and re-save a drawing, to migrate it to the newest file format versions. Small tweaks: * On bounded levels, allow the camera to still follow the player if the player finds themselves WELL far out of bounds (40 pixels margin). So on bounded levels you can create "interior rooms" out-of-bounds to Warp Door into. * New wallpaper: "Atmosphere" has a black starscape pattern that fades into a solid blue atmosphere. * Camera strictly follows the player the first 20 ticks, not 60 of level start * If player is frozen, directional inputs do not take the camera focus back.
2023-03-08 05:55:10 +00:00
{
Label: "Atmosphere",
Value: "atmosphere.png",
},
{
Separator: true,
},
{
Label: "Custom wallpaper...",
Value: CustomWallpaperFilename,
},
}
)
// Customize the various button styles.
func init() {
// Primary: white on rich blue color
ButtonPrimary.Background = render.RGBA(0, 60, 153, 255)
ButtonPrimary.Foreground = render.RGBA(255, 255, 254, 255)
ButtonPrimary.HoverBackground = render.RGBA(0, 153, 255, 255)
ButtonPrimary.HoverForeground = ButtonPrimary.Foreground
// Danger: white on red
ButtonDanger.Background = render.RGBA(153, 30, 30, 255)
ButtonDanger.Foreground = render.RGBA(255, 255, 254, 255)
ButtonDanger.HoverBackground = render.RGBA(255, 30, 30, 255)
ButtonDanger.HoverForeground = ButtonPrimary.Foreground
ButtonBabyBlue.Background = render.RGBA(40, 200, 255, 255)
ButtonBabyBlue.Foreground = render.Black
ButtonBabyBlue.HoverBackground = render.RGBA(0, 220, 255, 255)
ButtonBabyBlue.HoverForeground = render.Black
ButtonPink.Background = render.RGBA(255, 153, 255, 255)
ButtonPink.HoverBackground = render.RGBA(255, 220, 255, 255)
ButtonLightRed.Background = render.RGBA(255, 90, 90, 255)
ButtonLightRed.HoverBackground = render.RGBA(255, 128, 128, 255)
}