Commit Graph

35 Commits

Author SHA1 Message Date
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
4d64d6fa12 Initialize and dispose of whiteTexture in SneakGame.
Fixes #7.

GitOrigin-RevId: 024688e8fc8ed28950147baefc2fda2005e6aced
2020-02-13 18:36:48 -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
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
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
80746ecaed Use world definition from Levels file
GitOrigin-RevId: a5d19f4f0828bb52989b12590d6e364d0edd918b
2020-02-13 14:54:38 -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
0e363de306 change player sprite to ninja
GitOrigin-RevId: 73bc09808a1abf1a130986adfed1d3aa6d220b5c
2020-02-13 14:53:11 -05:00
76dbdc6913 Bound camera by right edge of World.
Fixes #32.

GitOrigin-RevId: e193c89509be035d5f6e899cd8c33ff2534a777f
2020-02-13 14:52:55 -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
793b292a29 pass in AABBs instead of Rectangles to Player.Update
GitOrigin-RevId: 08fe1aaf34210415acaa41e7e407eb1275602889
2020-02-13 14:52:35 -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
8c6b0e3c92 set vsync = true; setting it false seems to cause crashes on UWP
GitOrigin-RevId: 6f30cefcaa6c61fb0fc3b20eada333db79f4c480
2020-02-13 14:51:51 -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
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
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
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
cc37561076 run dos2unix on all source files
GitOrigin-RevId: c65ff59d86415057167f600d1c31545b1ff0b49b
2020-02-13 14:49:30 -05:00
660d163119 converted all TODOs into Issues
GitOrigin-RevId: aae80308b34fcfa7a99b8dc97c56ee33ceb900ef
2020-02-13 14:49:08 -05:00
f0630d1679 go back to just a single RenderTarget
GitOrigin-RevId: 0b8fc3090098f84047a85804bb5eb2a15249aadd
2020-02-13 14:48:44 -05:00
d75a469acc Move JumpyGame -> SneakGame & fix references
GitOrigin-RevId: ec99138000848e4cdcf371b53ce0dd2fe5ebed70
2020-02-13 14:48:39 -05:00