Commit Graph

259 Commits

Author SHA1 Message Date
f801f95551 move to a root LICENSE.txt 2020-03-02 20:46:44 -05:00
65fe870a9a let Scene decide when to draw itself & when to play music
GitOrigin-RevId: 0eac6682b0bbe4d436707c44d9685c1e518b8295
2020-03-02 16:47:42 -05:00
29cf5eb0c9 add short music loop to demo stage
GitOrigin-RevId: 7ea3d773b12341eb3eb3aabd9000cc32014faac8
2020-03-02 15:33:56 -05:00
02b1dd4874 Add simple NPC.
GitOrigin-RevId: 47cd7abaf80d7ced14d0b4b92390c8c0edddae1c
2020-02-28 17:13:52 -05:00
d9e9fcf9a2 remove trailing whitespace
GitOrigin-RevId: 4ccd727a7921e8ef08296586283d84bdc6f31c99
2020-02-27 20:24:40 -05:00
de8ca4a374 Add sword-swing sound effects.
GitOrigin-RevId: 946a808c6f7e96297ec291f2b8e55ae062d5193b
2020-02-27 20:24:36 -05:00
f4581ecaf8 Player now takes damage from spikes.
GitOrigin-RevId: e9096316218f2590aac74ce1055a0829f71bdff8
2020-02-27 19:13:59 -05:00
a431ad094b smush hearts together a smidge
GitOrigin-RevId: ebb0e78ff5f3c51d6ddc9765e38fb262bccee160
2020-02-27 16:50:19 -05:00
c189cfcc09 Add player health & a heart sprite.
GitOrigin-RevId: 3389f46044a3fbb48af8533370c0318982c9ad83
2020-02-27 16:28:48 -05:00
c213009134 Add Text.DrawOutlined() function & other text helpers.
GitOrigin-RevId: 47f9115767c9acac31edaed13ba0ac62732a27f1
2020-02-27 15:46:54 -05:00
830fc1ee9a set font to be PointClamped
GitOrigin-RevId: 6f21d2f11df5ba30061ca2994988f5bbd5d38b1d
2020-02-27 11:54:37 -05:00
c2fa12db9b Stop printing out jumpTime.
GitOrigin-RevId: dc062283389545c0dd55a3438cc192c2d449ef9a
2020-02-26 17:59:09 -05:00
f8fa66385d Display "Paused" message when paused.
Add a new "Banner" style font for the pause message.

GitOrigin-RevId: 62f9537574351b961d7a2bd74f12e218f1047062
2020-02-26 17:44:36 -05:00
5549f15029 rename numEdgeVertices -> NUM_EDGE_VERTICES
GitOrigin-RevId: c7a67e06ea330f1fd3de4abdbeb8021402b6f330
2020-02-25 20:34:49 -05:00
3a8defcf3f Letterbox the scene if the aspect ratio is out-of-whack.
Fixes #23.

GitOrigin-RevId: 2da580115e44f2658e7f9b9d3d39a366d3a1bbfd
2020-02-25 20:24:19 -05:00
0a64d17db5 fix lint errors
GitOrigin-RevId: 5de396b25947e1de5bea55ecc32bacc59e5b336d
2020-02-25 19:19:10 -05:00
bd78586a1d rm newline
GitOrigin-RevId: c369e8bd9f847a038c544db1094ba1aabbcf388d
2020-02-25 10:30:57 -05:00
74b5e1ec2d Debug rects: pull in top & left sides by a 1-pixel margin.
GitOrigin-RevId: 0f1f846e3f9251699917c43241efe73d6ba74849
2020-02-25 09:58:42 -05:00
a0ea63f96b make Input readonly
GitOrigin-RevId: 1bb3c6bb6fad236b0b974a78b2d0c75474c9fa23
2020-02-25 09:35:59 -05:00
4e4c2cccb3 Input: process debugging commands first & exit early if any are pressed.
GitOrigin-RevId: c36acce59305a0f2086b88c6206f73e3860e0c51
2020-02-25 09:26:28 -05:00
6802b3f162 Make separate ExtensionMethods file.
Add Point-deconstruction as an extension method.

GitOrigin-RevId: a804ba797a9b939b65652df67987628b1742dad6
2020-02-24 20:46:24 -05:00
f081a3db4e Apply VS suggestion for refactoring TextureRef.Get
GitOrigin-RevId: 9758a333c456f6a150282d3f4adb00c68095e416
2020-02-24 17:07:42 -05:00
26649ce20d Draw debug output within the TV-safe area.
Details here:
https://docs.microsoft.com/en-us/windows/uwp/design/devices/designing-for-tv#tv-safe-area

GitOrigin-RevId: 6bd4e9805a078f6b21cc40fc633c36cde371b6e6
2020-02-21 10:24:31 -05:00
ed7afd2fa1 TextureRef: make Get a property rather than a function
GitOrigin-RevId: a36369c33b0c23859768c7bd7b1548b7d834cbb3
2020-02-20 16:39:38 -05:00
e72b8999e4 Make TextureRef class for holding textures.
Use it in World so that all Terrain-specific configuration can be specified in
one place.

GitOrigin-RevId: 31acf292ae6e438f609a7396e78555e1db9b744e
2020-02-20 16:37:52 -05:00
0e164f7b75 mark field readonly
GitOrigin-RevId: 9e06f8a03a69c18da9e4828263eed65b13776904
2020-02-20 16:37:48 -05:00
0ee671c8b1 fix how the first line of World is parsed
GitOrigin-RevId: 9409e491fd04067af750333b693d0f992bf6315d
2020-02-20 13:37:32 -05:00
c4e211e750 more level decorations
GitOrigin-RevId: b6446a7451f877fc7c46a35a49d450dd1f3b9c26
2020-02-20 13:37:28 -05:00
f1b71ca87d Tiles can now be obstacles (in the foreground) or decorations (in the background).
Updated Levels to show off some of these.

GitOrigin-RevId: d8d04410c15dd36218d5a1504dd842827082180f
2020-02-20 12:26:47 -05:00
08a31231e9 Draw LinesOfSight behind most other things.
Also remove the currently-unneeded lightingTarget.

GitOrigin-RevId: 95d96d966a07624b2c6c648d7c208cfa16acd2b9
2020-02-19 17:33:44 -05:00
2fe8e53e77 Call GC.SuppressFinalize() from Dispose().
GitOrigin-RevId: 57b1d3760a781966e3dd673970b535bb8cade1a2
2020-02-19 17:18:25 -05:00
af9a48bc5d small cleanups suggested by VS
GitOrigin-RevId: b1b3a687e399f0672a436c6542914143adaea6bb
2020-02-19 16:36:51 -05:00
026623ac82 Fix memory leaks of graphics resources.
Make Scene & LinesOfSight dispose of the graphics resources they create.

Force GC when a new level is loaded.

GitOrigin-RevId: 0640cced784e6bf5ee15f4edce8bf11d122dac51
2020-02-19 16:33:32 -05:00
1eb4d7a7d2 Debug off by default
GitOrigin-RevId: 0e0325057b0b6fad5b11a2072dd6bb14643b7847
2020-02-19 15:34:28 -05:00
44bd3c6896 Show lines of sight only when Debug enabled
GitOrigin-RevId: 77de51cce5e9e6a009a866e0eb5bc213f00b176c
2020-02-19 15:09:03 -05:00
b858c45b7e Cycle through levels when player hits the "restart level" button.
GitOrigin-RevId: bbe909515fbc4b61be3357e506a113e82bb6e2bd
2020-02-19 15:07:55 -05:00
6b9aa0844c Update demo level.
GitOrigin-RevId: 90064478fe88d5dc7ade74ac2417012c16e639fa
2020-02-19 15:07:52 -05:00
0df153581c Add new terrain types to World
GitOrigin-RevId: ab811a1b52ea011a7acea078ec6e78735a298d59
2020-02-19 15:07:48 -05:00
b06155aa88 Render backgrounds from back-to-front in an array.
GitOrigin-RevId: 1f4ca760d4dc4a73a4f96f6b04ee2929e789a5eb
2020-02-19 15:07:44 -05:00
cf5167fba7 Player: tweak constants, track jump hangtime.
GitOrigin-RevId: 868003a32664b89212cdb4cf082d96016c5529f9
2020-02-19 15:07:40 -05:00
90b003e0b0 Change Debug button from left shoulder to Select.
GitOrigin-RevId: 7e633c9904572c0f88859f2929ee5743ae2f3261
2020-02-19 15:07:36 -05:00
05638483a4 Support 4-layer parallax-scrolling backgrounds.
GitOrigin-RevId: 58c1d1fee99e56dd656af5bbf628fbdc16d55e14
2020-02-19 13:07:58 -05:00
8405f32f3c simplify lightingEffect initialization
GitOrigin-RevId: 28ca3d2336fe78f152aff2b810e90dc06e7816b6
2020-02-19 11:24:56 -05:00
57d15cbbd9 Load all textures & fonts in one place.
GitOrigin-RevId: 076c86b24f4e4e314a52457a01d5c77e197a2fa2
2020-02-19 11:20:20 -05:00
8f5514b776 More refactoring of Tile loading.
GitOrigin-RevId: 96a697bc78cdaefc874b9eb7b9d4cca28efe27f2
2020-02-18 16:50:47 -05:00
2934296649 Refactor tile creation to support assets from multiple tilesets.
GitOrigin-RevId: 9863c368214536e09009e27dcb68b8d42f3d04f0
2020-02-18 15:24:49 -05:00
02aba3ad84 Game objects now take in a ContentManager & load their own textures.
GitOrigin-RevId: 4f40548d9f100f4bad181a59f4df44397f7ccf76
2020-02-18 13:58:04 -05:00
f0ea8d8ef2 Reorganize Content/ into multiple subdirectories.
Add new tilesets from anokolisa.

GitOrigin-RevId: 90cfd52a3c374beff7c1b8d07899e822bdf2e541
2020-02-18 10:30:05 -05:00
9eeede2310 Shared.shproj: remove redundant & out-of-date file listings
GitOrigin-RevId: e7cc4d730faa5bc22a6aae55df53d55c6e44b41a
2020-02-17 21:22:16 -05:00
7935b6aaff Scene: go back to drawing Player behind tiles.
GitOrigin-RevId: afaff144f2af1f0ebcaf5b640cb621413110f380
2020-02-17 21:22:12 -05:00
7e7b0f7715 Move most of the drawing code into a Scene class
GitOrigin-RevId: 4515493a3bbf99b9513f2f1e66acadae1df53a5a
2020-02-17 21:08:32 -05:00
43f6bded70 draw backgrounds as partially transparent
GitOrigin-RevId: b570a9aab75d18e6f7778dc851537794f30d801a
2020-02-17 19:59:52 -05:00
786b230a6c LinesOfSight: don't draw yellow lines
GitOrigin-RevId: 1ebd5fe922856036d814a129520a5f3d6e1e4447
2020-02-16 19:44:36 -05:00
e2ea2e1d3f Add ability to restart the level. Fixes #9.
GitOrigin-RevId: e7a0cdcdded50e2f02067a166a33e18504aac344
2020-02-16 19:22:36 -05:00
1ffe1444b2 Debug: draw rects as 4 GPU-accelerated lines.
GitOrigin-RevId: 3286d0476b5032d785f74191609db4fbd768433c
2020-02-15 16:32:39 -05:00
48a9297a57 draw Debug stuff on top of everything (after lighting)
GitOrigin-RevId: e07fbc6b27af23912de1344a1bc3788ef69fd9c5
2020-02-15 16:32:34 -05:00
5d21ff2a0f Debug.DrawLines: use GPU to draw lines.
Fixes #19.

GitOrigin-RevId: d837e0ddafa0b7ea66fea4bba05ca7412a3c5726
2020-02-15 15:47:45 -05:00
a21802e9f2 FMath.DegToRad(): use look-up table.
GitOrigin-RevId: 2dab2e175cf99448595304eeb7593bf499485273
2020-02-15 15:15:24 -05:00
24078d6c62 move FieldOfView into Player
GitOrigin-RevId: 6d6a4094533819b11deebd5319616b5f5ed68948
2020-02-15 15:00:26 -05:00
66f895fab8 Player: remove GetPose, add VisionRange and VisionRay.
Fixes #21.

GitOrigin-RevId: 720972d1c8bd989edc38289f2e66e91290cf0134
2020-02-15 14:57:21 -05:00
c94ae6eb25 Player: make Facing an int property.
Partial work toward #21.

GitOrigin-RevId: 902c46d19abb7c1a2c3a2aa3bfb344d52fa6a970
2020-02-15 14:49:35 -05:00
4d64d6fa12 Initialize and dispose of whiteTexture in SneakGame.
Fixes #7.

GitOrigin-RevId: 024688e8fc8ed28950147baefc2fda2005e6aced
2020-02-13 18:36:48 -05:00
257a74ca58 LinesOfSight: use less-deprecated DrawIndexedPrimitives() call.
GitOrigin-RevId: 87d9482de392dfc659cc5c7e8fa354e9b6941425
2020-02-13 16:05:05 -05:00
23278334b0 use DrawIndexedPrimitives; fixes #41
GitOrigin-RevId: 6cc7429d0b69ace6da4f965af6f70fff2f1e139b
2020-02-13 14:55:22 -05:00
f01efcde01 Split LinesOfSight into separate Draw() and Update() functions.
Don't make new arrays every frame.

Partial solution to bug #41, just need to DrawIndexedPrimitives() now.

GitOrigin-RevId: 0e769d3288dce17fe174b2a1d82a99b1d9994213
2020-02-13 14:55:18 -05:00
5b7c0dd888 move LinesOfSight into its own file
GitOrigin-RevId: 21a722cc9d31abf0f5d33cccebb82d7786e45fde
2020-02-13 14:55:14 -05:00
93a5d477bb New FOV algorithm that works pretty well.
Saved for posterity here, approximately:
https://twitter.com/mcmillen/status/1227326054949408768

GitOrigin-RevId: e960dad1d9241c08dbf1292c6856311d4ebd7a85
2020-02-13 14:55:02 -05:00
7cc953a44e add extension method: Vector2.Rotate()
GitOrigin-RevId: ee1e84ff188d5a3134dafb1f5150199682c4e063
2020-02-13 14:54:58 -05:00
ff0c9ddc26 Add a transformation matrix to spriteBatch.Draw().
Instead of having every drawable object know how to transform itself based on
the camera position, we pass in a transformation matrix to spriteBatch.Draw().
Unfortunately MonoGame only lets us specify a translation that works over an
entire SpriteBatch.Begin() call, so we need to begin & end separately for
objects that *aren't* supposed to translate at the same rate as the camera.

Fixes #39.

GitOrigin-RevId: afab72c39236b1b46fe1597412209981ddae9c7c
2020-02-13 14:54:46 -05:00
6b9890b6f7 Player: more line-of-sight debug lines
GitOrigin-RevId: 655eef228659215ce53ac3e58bc324581a0fec3f
2020-02-13 14:54:42 -05:00
80746ecaed Use world definition from Levels file
GitOrigin-RevId: a5d19f4f0828bb52989b12590d6e364d0edd918b
2020-02-13 14:54:38 -05:00
d30be7a460 Timer: don't automatically DumpStats(); refactor string prefixes during dump
GitOrigin-RevId: 93b7d652823785b2be1074af50dbe4952e288856
2020-02-13 14:54:34 -05:00
5672e292cc add Levels file to hold level definitions (for now)
GitOrigin-RevId: ba9c09158f615844be53a1c294d7b8d88c9a62e2
2020-02-13 14:54:30 -05:00
2d2a3fde7d Timer formatting: change 200%+ to 200+%
GitOrigin-RevId: d04c35760d8e05404fda01c0adac8a5c465423b7
2020-02-13 14:54:26 -05:00
80f1104d82 Timer: better histogram formatting. bin into 10% intervals instead of 5%
GitOrigin-RevId: 9729f04bd650e530d6e60efbed348d6269608f16
2020-02-13 14:54:22 -05:00
9e4d863bcf add performance counters to SneakGame. Fixes #33.
Also, suppress drawing until Draw() has not been IsRunningSlowly for two
frames. This prevents janky behavior that happens during loading (I suspect
while texture loading is happening, but I'm not sure?)

GitOrigin-RevId: 5df31be3710457c7a8dae38b0b61c5dc50e3c54c
2020-02-13 14:54:18 -05:00
0f9d546398 make Clamp() generic across comparables and move it into FMath.
GitOrigin-RevId: 4ed26cc24dd204813540bde36889a17c20ad007b
2020-02-13 14:54:14 -05:00
bf2f33f698 add Timer class to projitems
related to issue #33

GitOrigin-RevId: 2870974cfb34ec14a754d6fcdc976fc7e3fb126c
2020-02-13 14:54:10 -05:00
36ebeadddf add Timer class for tracking draw & update times (etc)
related issue: #33

GitOrigin-RevId: 3762a7a5c7becf83cc50f80d4e5bb6f27244a952
2020-02-13 14:54:06 -05:00
d44ac76d49 fix cones-of-sight tilting in the wrong up/down direction when facing left
GitOrigin-RevId: 6b4925c75f44069af84685bc749a3586ad376e1d
2020-02-13 14:54:02 -05:00
4758ce519b allow player to look up/down
GitOrigin-RevId: 00041d67360a610ff032a0ab0ea5826e091f1c90
2020-02-13 14:53:58 -05:00
1f7da03515 make char-to-terrain lookup dictionary-based instead of switch-based
GitOrigin-RevId: 0d81e95bf047fab204bff8cf46ece2ab5470bf09
2020-02-13 14:53:54 -05:00
b731e1a785 make tile-texture lookup dictioanry-based instead of switch-based
GitOrigin-RevId: 2f0c215bf9e79e92f2c7a5011d8df3d9d80a0dff
2020-02-13 14:53:50 -05:00
c1232d462d make swordSwingMax const
GitOrigin-RevId: 911bff5fb60d0442edbe1e4ff9c005558a258175
2020-02-13 14:53:46 -05:00
3286db1c86 remove Terrain.Empty and clean up TextureSource() switch statement
GitOrigin-RevId: 7de691a440982a027898b123b864ff202ae68ea5
2020-02-13 14:53:43 -05:00
f7f7d5076e Pre-compute texture-source Rectangles.
Fixes #14.

GitOrigin-RevId: e09d86a099ac9274a4f3b7dcac9a2222b461dcea
2020-02-13 14:53:39 -05:00
5cb3ff9fbd first pass at implementing line-of-sight algorithm
partial solution for #29

GitOrigin-RevId: bb5f5dc057ba5947573f9b9c8eb30cc20f635bb0
2020-02-13 14:53:35 -05:00
554578968d Geometry: add FMath class & convenient accessors for AABB corners.
The FMath class is like the System.Math class, but returns floats instead of
doubles so that you don't have to redundantly cast things.

GitOrigin-RevId: 0e1d7f46c7a5c08c1bc2d2c8776ffa56eab697d8
2020-02-13 14:53:31 -05:00
141a0660c4 Debug: draw lines correctly based on camera position.
Make convenience function for calling AddLine() with Vectors.

GitOrigin-RevId: 6ca9849f11a1db40cc7aeb3400e711d99f7946b3
2020-02-13 14:53:27 -05:00
1fd515070d make it possible for new sprite to hit the right end of world
GitOrigin-RevId: 95f7abdea1ea08b61aaf43a010e2c891cef5ead9
2020-02-13 14:53:23 -05:00
57b65f559c rename Aabb -> AABB
GitOrigin-RevId: 37b49d7a3ff2b4d0cf3e14e4339316bc72e2785e
2020-02-13 14:53:19 -05:00
f78bff249c cycle through different attack animations
GitOrigin-RevId: e40102b81be56d59948fbfd92d2536262f521c8a
2020-02-13 14:53:15 -05:00
0e363de306 change player sprite to ninja
GitOrigin-RevId: 73bc09808a1abf1a130986adfed1d3aa6d220b5c
2020-02-13 14:53:11 -05:00
10453ee5ea World: add Height property (in pixels)
GitOrigin-RevId: 0ae9f03f8e43ee31d42d3393b51c34d0fcd58db5
2020-02-13 14:53:03 -05:00
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
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
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
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
db6f3e1425 Add Input class to group gamepad & keyboard inputs together.
For motion directions (up/down & left/right), have them cancel each other out
if the player attempts to go in opposite directions at once.

Refactor Player & SneakGame to use the new Input class & remove direct access
to Keyboard & GamePad.

GitOrigin-RevId: 80fbed887408ae2b80c01273a49b150f38285dcb
2020-02-13 14:49:45 -05:00
9a1c6646dd properly handle non-rectangular input string[]s
GitOrigin-RevId: eb580f2e9c5a6d93827982240fd295ba30fdb0c4
2020-02-13 14:49:41 -05:00
f58faa0b9f comment out Toast from Camera
GitOrigin-RevId: 3507b5cd381e69ea1d86b533b9e7335df3afeb4b
2020-02-13 14:49:37 -05:00
fb074dc318 History: make backing array readonly
GitOrigin-RevId: 33c1bfb915b4f2fb80c3bb1f4b88ef924a45363d
2020-02-13 14:49:34 -05:00
cc37561076 run dos2unix on all source files
GitOrigin-RevId: c65ff59d86415057167f600d1c31545b1ff0b49b
2020-02-13 14:49:30 -05:00
960521a6e0 History: add ToArray() method to make tests cleaner
GitOrigin-RevId: 5bbf5be614ed6c2d9884ac924ab627ccaa57e355
2020-02-13 14:49:26 -05:00
b169584794 cleanup: spritePosition -> SpritePosition
GitOrigin-RevId: b715b0be5499f41c905257f3b19481a9fd81bf71
2020-02-13 14:49:15 -05:00
361a02c67f rm KeyboardInput
GitOrigin-RevId: 1725d577c5be04488a6723b65c0c93fa25d12ab5
2020-02-13 14:49:12 -05:00
660d163119 converted all TODOs into Issues
GitOrigin-RevId: aae80308b34fcfa7a99b8dc97c56ee33ceb900ef
2020-02-13 14:49:08 -05:00