2018-08-17 03:37:19 +00:00
|
|
|
package balance
|
|
|
|
|
|
|
|
// Numbers.
|
|
|
|
var (
|
2018-10-08 17:38:49 +00:00
|
|
|
// Window dimensions.
|
|
|
|
Width = 1024
|
|
|
|
Height = 768
|
|
|
|
|
2018-08-17 03:37:19 +00:00
|
|
|
// Speed to scroll a canvas with arrow keys in Edit Mode.
|
|
|
|
CanvasScrollSpeed int32 = 8
|
2018-09-23 22:20:45 +00:00
|
|
|
|
Play: Autoscrolling and Bounded Level Support
Implement scrolling behavior in Play Mode by allowing the Canvas to
follow a specific actor and keep it in view. The Canvas has a
FollowActor property which holds an ID of the actor to follow (if blank,
no actor is being followed).
In Play Mode the Player is followed and when they get too close to the
left or right edges of the screen, the level will scroll to try and
catch them. If the player is moving very fast they can outrun the
camera.
The bounded levels are enforced in Play Mode and the camera won't scroll
to view pixels out-of-bounds and the Doodad actors inside the level
aren't allowed to exit its boundaries. This is global, not only for the
Player doodad but any Doodad that came with the level as well.
Other changes:
- Restructured Canvas widget code into many new files. The Canvas widget
is shaping up to be where most of the magic happens, which is okay
because it's close to the action and pulling the strings from outside
would be harder, even tho as a UI element you think it should be
lightweight.
- Debug Overlay: added room for Scenes to insert their own custom Debug
Overlay key/value pairs (the values are string pointers so the Scene
can update them freely):
- The core labels are FPS, Scene and Mouse. The Pixel (world
coordinate under cursor) is removed from the core labels.
- Edit Scene provides Pixel, Tool and Swatch
- Play Scene provides Pixel, Player, Viewport, Scroll
2018-10-29 00:33:24 +00:00
|
|
|
// Window scrolling behavior in Play Mode.
|
|
|
|
ScrollboxHoz = 64 // horizontal pixels close to canvas border
|
|
|
|
ScrollboxVert = 128
|
|
|
|
ScrollMaxVelocity = 24
|
|
|
|
|
|
|
|
// Player speeds
|
|
|
|
PlayerMaxVelocity = 12
|
|
|
|
Gravity = 2
|
|
|
|
|
2018-09-23 22:20:45 +00:00
|
|
|
// Default chunk size for canvases.
|
2018-10-18 06:01:21 +00:00
|
|
|
ChunkSize = 128
|
2018-09-26 17:04:46 +00:00
|
|
|
|
|
|
|
// Default size for a new Doodad.
|
|
|
|
DoodadSize = 100
|
2018-08-17 03:37:19 +00:00
|
|
|
)
|
2018-10-20 22:42:49 +00:00
|
|
|
|
|
|
|
// Edit Mode Values
|
|
|
|
var (
|
|
|
|
// Number of Doodads per row in the palette.
|
|
|
|
UIDoodadsPerRow = 2
|
|
|
|
)
|