Commit Graph

140 Commits

Author SHA1 Message Date
bb8cf9e63b make CollisionTargets an auto property
GitOrigin-RevId: ca7bf8f68bdc9cacef191cff5efe930ca7942b34
2020-02-13 14:52:59 -05:00
76dbdc6913 Bound camera by right edge of World.
Fixes #32.

GitOrigin-RevId: e193c89509be035d5f6e899cd8c33ff2534a777f
2020-02-13 14:52:55 -05:00
fe64ec705d Bound player position by both edges of the World.
Fixes #10 and #22.

GitOrigin-RevId: 166be078982f148035072b717b668d47d7541571
2020-02-13 14:52:51 -05:00
ab62e8929a cleanup: sprite{Height,Width} -> halfSize
GitOrigin-RevId: 5620d26f72ba46c74eb7f5335ad1d2b9a3b29602
2020-02-13 14:52:47 -05:00
50479bac3c while paused, don't clear the list of Debug rects & lines
GitOrigin-RevId: d298abc6ad4d7808da927a20c726cab6a65dc61c
2020-02-13 14:52:43 -05:00
588b18f9ad fix Debug.Toast() & re-enable it
GitOrigin-RevId: ae553145ed5884b46714dc1a2cb3d7b96e27cd42
2020-02-13 14:52:39 -05:00
793b292a29 pass in AABBs instead of Rectangles to Player.Update
GitOrigin-RevId: 08fe1aaf34210415acaa41e7e407eb1275602889
2020-02-13 14:52:35 -05:00
946497160b Player.Update() now uses Bresenham's line algorithm.
This works, but is still a bit hacky. Cleanups to follow soon.

GitOrigin-RevId: 597a857a200584fee2c06237d7d7dd10403bdfeb
2020-02-13 14:52:31 -05:00
4410ff137a add Debug.AddRect(AABB) function
GitOrigin-RevId: 0acfc3f43f9cc11d1c6925971f20ed6ed18cad61
2020-02-13 14:52:27 -05:00
f1f717da63 remove unused using statement
GitOrigin-RevId: d3730b153c23fe158f1cd2bd3bd1f222d1a0bc46
2020-02-13 14:52:23 -05:00
f2db2f4b9e use new collision-detection algorithm with old resolution algorithm (wip, slightly hacky)
GitOrigin-RevId: 998aa02a561ebf9f745b08b1186d39afad92a38e
2020-02-13 14:52:19 -05:00
08792320df make Facing's enum value correspond to the x-direction they're looking
GitOrigin-RevId: fe9318a68edd86a2dcfe949640aba48a2039f69e
2020-02-13 14:52:15 -05:00
bff5d2b490 enable Debug by default
GitOrigin-RevId: ba7ff1d9b775484baa023bfb6bb6cbe5bc64d7f8
2020-02-13 14:52:11 -05:00
878d434b22 Add code for intersecting axis-aligned bounding boxes with segments & each other
GitOrigin-RevId: 99a855c1a813c0fcdd4fca0fd31456b62e964abb
2020-02-13 14:52:07 -05:00
61b50efa40 make CollisionTargets an array, and don't recompute it every frame
GitOrigin-RevId: 92a02231edae5729778ea9ac60a46c83e248c744
2020-02-13 14:52:03 -05:00
644ed88dd8 World: add Tiles to list so that they're sorted by x-coordinate
GitOrigin-RevId: f9c6cf8be450fc78aca950ad63ffa8e86a488de3
2020-02-13 14:51:59 -05:00
57e9ea558a add Debug.AddLine() function that takes in integer coordinates instead of Points
GitOrigin-RevId: 145f4f076376bc63e6e899db49cdcfe10beacddf
2020-02-13 14:51:55 -05:00
8c6b0e3c92 set vsync = true; setting it false seems to cause crashes on UWP
GitOrigin-RevId: 6f30cefcaa6c61fb0fc3b20eada333db79f4c480
2020-02-13 14:51:51 -05:00
95acee959d clean up private fields/properties
GitOrigin-RevId: d2caf0d5d774e50ba4a2eb9cdc2a40ca28a094ce
2020-02-13 14:51:47 -05:00
7e8e5c3e6d pull Width and Height into properties
GitOrigin-RevId: fe969e51cd393ff350f57acc38cc416954d57252
2020-02-13 14:51:43 -05:00
16062f65c3 World: convert from Tile[][] to List<Tile>
GitOrigin-RevId: 27db59aa1170c63d815d9661ef6e5328a17c6a99
2020-02-13 14:51:39 -05:00
e6fa78e30f World: convert fields to properties
GitOrigin-RevId: 7b0552c278cfe48e66e806ff94106617bf834252
2020-02-13 14:51:35 -05:00
84fa044675 more readability fixed via Visual Studio suggestions
GitOrigin-RevId: 330f13485cee32f3a069442bad69c57911a0a34c
2020-02-13 14:51:31 -05:00
4b14aef1b5 make a bunch of fields readonly
GitOrigin-RevId: 0c3533c6509a6f0199410e977d3377c34b4a753d
2020-02-13 14:51:27 -05:00
0c7c15c047 set target framerate back to 60
GitOrigin-RevId: 7a97b3cd07afccafab047ad81df10269360b066e
2020-02-13 14:51:23 -05:00
f5ca85264f Add Clock class & use it from Player and SneakGame
GitOrigin-RevId: fe20c836ca693fdabad4ce72bfdf8952b59b735b
2020-02-13 14:51:19 -05:00
c7ec9e3ad7 start Player on ground
GitOrigin-RevId: e781328586e453e0e8c080b7ccb5026de3348064
2020-02-13 14:51:15 -05:00
1ea4d6c39b don't vsync; set target FPS to 120-ish
GitOrigin-RevId: 724e876b9ad97f515919cb150ef7be164d096367
2020-02-13 14:51:12 -05:00
87100eaa67 Player.Update now takes a float which is the model time elapsed.
Player.Draw doesn't depend on time elapsed any more.

GitOrigin-RevId: 3396f85f61c8ee430fda8986770663f561538294
2020-02-13 14:51:08 -05:00
83839c92ac add Pause functionality
GitOrigin-RevId: 18fb95475734fef498e64d7d0d350135f652e05c
2020-02-13 14:51:04 -05:00
63aa190afe move Debug.Enabled check into DrawToasts
GitOrigin-RevId: 8265b948f772443580166f89fc39d46735852da3
2020-02-13 14:51:00 -05:00
e30aa75f80 Debug: draw rasterized DebugLines to screen
GitOrigin-RevId: aa4253477fa8e3657e19c5e0d534a3288bc23a0a
2020-02-13 14:50:56 -05:00
bba9f643eb Implement Bresenham's algorithm for line rasterization.
This is implemented as a static Line.Rasterize(Point p1, Point p2) function
that returns an array of Points. There's also a Line.Rasterize(x1, y1, x1, y2)
version for convenience.

Unit tests included.

GitOrigin-RevId: 525098f8c76c6c3d1a6ff2c32fa2206cff080a11
2020-02-13 14:50:53 -05:00
252fe5b243 remove unused using
GitOrigin-RevId: 1584816927db6030172d5b762782d249ccd6aa0c
2020-02-13 14:50:50 -05:00
3246f8ea45 capitalize struct field names
GitOrigin-RevId: 6b4cca3873a88c308a98dac9282959b13ab840bb
2020-02-13 14:50:47 -05:00
cb66a32a24 add 1-space gap so that i can test bug #4
GitOrigin-RevId: 89e6e06f1dbf85823846757a57939a263c322947
2020-02-13 14:50:43 -05:00
34e7ab3ee1 make Toasts a list & implement FPS counter as a toast
GitOrigin-RevId: bae35697a0329f7d5c1c45cdbc13c3be500b8c73
2020-02-13 14:50:39 -05:00
bee17a99af create Debug.AddLine() function [currently does nothing]
GitOrigin-RevId: c4f9afb4b06181ddff79c207a99bb6ba902e7ade
2020-02-13 14:50:36 -05:00
938a38bd77 Camera.Update: remove unused time parameter
GitOrigin-RevId: b3c427b9ccee9a2cfef1c8f24d1c653d975cb513
2020-02-13 14:50:32 -05:00
8752f53ac8 add GitLab config to copybara config
GitOrigin-RevId: d933c46b219ef6d70e3616d206236329875e928f
2020-02-13 14:50:28 -05:00
ae8fa0d21d Revert "Add .gitignore and .gitattributes."
This reverts commit 5c9f574644ecd78b112ea857d658f670ef4773e3.

GitOrigin-RevId: 277054282d105e4a5f185ac51983581c89b8a031
2020-02-13 14:50:24 -05:00
cb1b78b875 Add .gitignore and .gitattributes.
GitOrigin-RevId: 5c9f574644ecd78b112ea857d658f670ef4773e3
2020-02-13 14:50:20 -05:00
f6f25144b6 SharedTests: don't depend on specific MonoGame version
GitOrigin-RevId: d30010bbacd2ae06bf6ca0055b39c29260682e29
2020-02-13 14:50:16 -05:00
ea07fc146b add TODO about setting ySpeed = 0 in head-bonk
GitOrigin-RevId: 657d92ebbd303e3da4375ad23dfaf403025622cf
2020-02-13 14:50:13 -05:00
2f75847615 remove toast
GitOrigin-RevId: f4e9adf692392df1406f55b32e4a441caeb56f58
2020-02-13 14:50:09 -05:00
459e43186a refactor Player input/state handling to be less tangled
GitOrigin-RevId: 68bd79b722d7fcf2ef8abaf644e2b13544a08ae8
2020-02-13 14:50:05 -05:00
ea82c4ffd3 rename SpritePosition -> SpriteIndex
GitOrigin-RevId: b620c8922b92ac9f5b1b4298dfa9ed35a7641f11
2020-02-13 14:50:01 -05:00
03b8688f1e World: use single multi-line string instead of a string[]
GitOrigin-RevId: 38c0745c95e2341a1a2712d480f6403a6ec68ecf
2020-02-13 14:49:57 -05:00
a719e5b370 Add secondary buttons for jump & attack
GitOrigin-RevId: adac7b3aa185e10e8cf86046f8a88817c300ef36
2020-02-13 14:49:53 -05:00
bbdc3c3053 SneakGame: remove History<GamePadState> & History<KeyboardState>.
GitOrigin-RevId: 1b8dfef93a9024094e342fd2f00f02513451c14f
2020-02-13 14:49:49 -05:00