Commit Graph

57 Commits

Author SHA1 Message Date
4870964cc5 attach LinesOfSight to the first NPC 2020-03-09 12:41:07 -04:00
fa4784fc49 IsHarmful -> IsHazard 2020-03-08 18:30:46 -04:00
5121f6d775 World: load levels by parsing a JSON level description. 2020-03-08 17:23:51 -04:00
0f8d9c2814 FSM / Player / NPCs now get World as an argument to Update() 2020-03-06 12:28:58 -05:00
b574a5a702 change Sprite / Animation times to double (sec) instead of int (ms). 2020-03-05 21:12:11 -05:00
53c6d8483f include multiple NPCs, have them turn around based on platforms. 2020-03-05 16:17:57 -05:00
0b8eb3e3f1 Player: start using Sprite data to calculate texture source / animations. 2020-03-05 15:28:34 -05:00
02b1dd4874 Add simple NPC.
GitOrigin-RevId: 47cd7abaf80d7ced14d0b4b92390c8c0edddae1c
2020-02-28 17:13:52 -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
c189cfcc09 Add player health & a heart sprite.
GitOrigin-RevId: 3389f46044a3fbb48af8533370c0318982c9ad83
2020-02-27 16:28:48 -05:00
c2fa12db9b Stop printing out jumpTime.
GitOrigin-RevId: dc062283389545c0dd55a3438cc192c2d449ef9a
2020-02-26 17:59:09 -05:00
0a64d17db5 fix lint errors
GitOrigin-RevId: 5de396b25947e1de5bea55ecc32bacc59e5b336d
2020-02-25 19:19:10 -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
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
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
cf5167fba7 Player: tweak constants, track jump hangtime.
GitOrigin-RevId: 868003a32664b89212cdb4cf082d96016c5529f9
2020-02-19 15:07:40 -05:00
57d15cbbd9 Load all textures & fonts in one place.
GitOrigin-RevId: 076c86b24f4e4e314a52457a01d5c77e197a2fa2
2020-02-19 11:20:20 -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
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
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
6b9890b6f7 Player: more line-of-sight debug lines
GitOrigin-RevId: 655eef228659215ce53ac3e58bc324581a0fec3f
2020-02-13 14:54:42 -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
c1232d462d make swordSwingMax const
GitOrigin-RevId: 911bff5fb60d0442edbe1e4ff9c005558a258175
2020-02-13 14:53:46 -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
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
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
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
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
61b50efa40 make CollisionTargets an array, and don't recompute it every frame
GitOrigin-RevId: 92a02231edae5729778ea9ac60a46c83e248c744
2020-02-13 14:52:03 -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
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
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
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