Noah Petherbridge
241186209c
Fixes: * Move the call to CollidesWithGrid() inside the Canvas instead of outside in the PlayScene.movePlayer() so it can apply to all Actors in motion. * PlayScene.movePlayer() in turn just sets the player's Velocity so the Canvas.Loop() can move the actor itself. * When keeping the player inside the level boundaries: previously it was assuming the player Position was relative to the window, and was checking the WorldIndexAt and getting wrong results. * Canvas scrolling (loopFollowActor): check that the actor is getting close to the screen edge using the Viewport into the world, NOT the screen-relative coordinates of the Canvas bounding boxes.
34 lines
648 B
Go
34 lines
648 B
Go
package balance
|
|
|
|
// Numbers.
|
|
var (
|
|
// Window dimensions.
|
|
Width = 1024
|
|
Height = 768
|
|
|
|
// Speed to scroll a canvas with arrow keys in Edit Mode.
|
|
CanvasScrollSpeed int32 = 8
|
|
|
|
// Window scrolling behavior in Play Mode.
|
|
ScrollboxHoz = 64 // horizontal px from window border to start scrol
|
|
ScrollboxVert = 128
|
|
ScrollMaxVelocity = 8 // 24
|
|
|
|
// Player speeds
|
|
PlayerMaxVelocity = 8
|
|
PlayerAcceleration = 2
|
|
Gravity = 2
|
|
|
|
// Default chunk size for canvases.
|
|
ChunkSize = 128
|
|
|
|
// Default size for a new Doodad.
|
|
DoodadSize = 100
|
|
)
|
|
|
|
// Edit Mode Values
|
|
var (
|
|
// Number of Doodads per row in the palette.
|
|
UIDoodadsPerRow = 2
|
|
)
|