Commit graph

13 commits

Author SHA1 Message Date
eea49ed3c1 Resolve all the pylint warnings in geometry 2022-05-07 12:37:35 -07:00
d0a2e2c2ef Clean up imports and terminal newlines in files according to pylint 2022-05-07 11:22:54 -07:00
4002b64640 Attack!!!
Refactor MovePlayerAction into a few different Action subclasses. Move direction
to a parent MoveAction, and create three new subclasses of MoveAction:

    - BumpAction: perform the test that an action can be performed in the given direction
    - WalkAction, take a step in the given direction
    - MeleeAction, attack another Entity in the given direction

Add an ActionResult class that communicates the result of performing an Action.

    - ActionResult.succeeded indicates whether the action succeeded.
    - ActionResult.done indicates if the action is fully complete or requires followup.
    - ActionResult.alternate specifies the follow-up action to perform.

Convert all the key handling actions to BumpActions.

In the Engine's event handler method, loop until an action is completed,
performing specified alternate actions until the result object indicates the
action is done.
2022-05-07 11:16:17 -07:00
1cd45d366b Add Direction.all() that returns an iterator that produces all the Direction values 2022-05-05 08:37:48 -07:00
fcfab9fc1b Add Rect.inset_rect 2022-05-03 19:02:39 -07:00
e1044f3a73 Move MovePlayerAction.Direction to geometry.Direction 2022-05-03 18:21:24 -07:00
3e87ef7279 Implement __iter__ on the geometry types so you can tuple(thing) 2022-05-01 17:43:13 -07:00
8b9897f0cc Convert the geometry types to frozen dataclasses 2022-05-01 17:32:48 -07:00
a54828c7fb Fix up all the runtime errors caused by the previous refactoring 2022-05-01 09:51:22 -07:00
a422a74a17 Refine the geometry classes; add __add__ method for Points and Vectors 2022-05-01 09:26:20 -07:00
e7a5af59ed Add mid coordinate and midpoint properties to Rect 2022-05-01 00:08:10 -07:00
3e4f065b96 Fix the max properties on Rect; add min properties 2022-04-30 23:29:24 -07:00
4f6d04456c Add some basic geometry primitives
Point, Vector, Size, and Rect. These are modeled on the CoreGraphics types.
2022-04-30 21:59:33 -07:00