Commit Graph

138 Commits

Author SHA1 Message Date
Sage Vaillancourt 09e48b65b4 Fix pitching 2025-02-24 19:49:32 -05:00
Sage Vaillancourt 9bbd68c302 Some other small main.lua refactoring 2025-02-24 17:01:51 -05:00
Sage Vaillancourt 7c7b5ff762 Extract Game:updatePitching()
Also, pull more from updateGameState() into updateBatting()
2025-02-24 16:24:21 -05:00
Sage Vaillancourt b928ee3658 Tuck bat away if `batter` is `nil` 2025-02-24 15:55:59 -05:00
Sage Vaillancourt 3a465cb02d Extract UserInput as an InputHandler.
Homogenous with Npc, which now also implements InputHandler.
2025-02-24 15:37:05 -05:00
Sage Vaillancourt b44756ff57 Add testBall.lua, testMain.lua, and testStatistics.lua
testMain.lua is really just a does-this-big-harness-work check right now, but it does work!
Extract statistics.lua for testing
Consolidate BoxScore ALL into draw/box-score.lua
2025-02-24 13:33:34 -05:00
Sage Vaillancourt 48a9854653 Remove unused param 2025-02-24 11:36:07 -05:00
Sage Vaillancourt 51c80fa427 Add testActionQueue 2025-02-24 11:34:28 -05:00
Sage Vaillancourt 19ddae6273 Remove or update some outdated TODOs 2025-02-23 18:23:19 -05:00
Sage Vaillancourt 687bf74979 Check for a game over after each score.
In case the home team just came from behind in the bottom of the final inning.
2025-02-23 18:17:09 -05:00
Sage Vaillancourt aa72d2a19f Remove the TODO for the previous runner fix. 2025-02-23 18:11:39 -05:00
Sage Vaillancourt f42ef06ff6 Only one runner can be safe on one base at a time.
Test this new change.
Add custom printTable() for use in test code.
2025-02-23 18:10:56 -05:00
Sage Vaillancourt aceefeb25c Add a screen for showing the game's controls
Tweak MainMenu appearance to show this new option.
Simple new drawButton() graphics function.
Set a max value for transition delta, to keep from leaving gaps in the mask.
2025-02-23 13:10:09 -05:00
Sage Vaillancourt d82ab06534 Use `-v` in `make test` 2025-02-23 11:11:04 -05:00
Sage Vaillancourt 3715361718 Move fielder targeting to array-based system
Allows for *light* path-finding, but is currently liable to totally lose track of weirdly-hit balls.
BUT this may be more of an issue of not correctly parsing the ball's state (home run, foul ball, etc.
Bat is now white with a black outline.
Some linting.
Run tests with `-v`
playdate.timer.new in mocks.lua
Add test for ball-catchability.
2025-02-23 11:10:40 -05:00
Sage Vaillancourt 7525daccb6 Add testGraphics.lua
Fix bug on exactly-zero/exactly-400 ballX
2025-02-23 11:03:10 -05:00
Sage Vaillancourt 9dc8b10f15 Better spacing in assets file 2025-02-22 14:01:37 -05:00
Sage Vaillancourt cea10a7706 Sort assets alphabetically 2025-02-22 13:43:34 -05:00
Sage Vaillancourt 7deadbe316 Remove some accidentally-committed testing code
Use blipper for scoredRunners
2025-02-21 15:18:11 -05:00
Sage Vaillancourt 7b49603760 Fix flickering on return-to-pitcher.
Some linting.
Prevent runners "sticking" to bases during walk/homeRun sequences.
Tweak logo to remove some trailing pixels.
2025-02-21 15:05:14 -05:00
Sage Vaillancourt 786f80b0df Add dark-skin player sprites.
SpriteCollection -> PlayerImageBundle
SpriteCollection is now PlayerImageBundle[]
2025-02-20 20:33:46 -05:00
Sage Vaillancourt 384a14fe5f Draw fans in the stands 2025-02-20 15:21:20 -05:00
Sage Vaillancourt 56c0c27d75 Add perfect-power indicator to throwMeter
Some other tightening-up in there.
E.g. clears the lastReadThrow when on a new fielder.
Add type annotations to assets files.
2025-02-20 13:56:57 -05:00
Sage Vaillancourt 35c7754207 Merge branch 'main' of https://git.sagev.space/sage/BatterUp 2025-02-20 13:52:22 -05:00
Sage Vaillancourt 92985da58f Add some sprites for fans 2025-02-20 13:51:44 -05:00
Sage Vaillancourt 17a30e9822 Extract 'Fielders' type and drop 'ignore 631' 2025-02-20 01:03:04 -05:00
Sage Vaillancourt 2d6f83a23f Add some slight linger time to draw/throwMeter 2025-02-20 00:28:14 -05:00
Sage Vaillancourt e45231dadd Lower MinCharge and idealPower
Makes it easier to throw at top speed without having to flick the crank.
Added a bit of a multiplier on the returned powerRatio, to compensate.
2025-02-20 00:16:32 -05:00
Sage Vaillancourt 08a3189780 Start supporting less accurate pitches
Fix secondsSinceRunnerLastMove nil bug
2025-02-20 00:06:43 -05:00
Sage Vaillancourt d77675b0cb Fix initial throw to pitcher being counted as a pitch. 2025-02-19 23:48:19 -05:00
Sage Vaillancourt 56a5e197cd Linting, and pitcherIsReady() timing tweak 2025-02-19 23:38:51 -05:00
Sage Vaillancourt 699dab8c7d Fielder.catchEligible -> Ball.catchable
Much simpler
2025-02-19 23:06:22 -05:00
Sage Vaillancourt b003c148a4 Extract more into pitching.
More consistent (and visible!) throw meter.
It's still imperfect (by a lot!) but it feels much more controlled.
Throws are a little too soft right now, but it's in a halfway decent state.
2025-02-19 22:32:10 -05:00
Sage Vaillancourt 52434fe891 Correct and further consolidate returnToPitcher() 2025-02-19 17:26:05 -05:00
Sage Vaillancourt ad82035ccc Pan back from home runs
Move secondsSinceLastRunnerMove into Baserunning
Tweak draw offset logic - a little jumpy, but better at following the long ball
Taller GrassBackground
Move secondsSinceLastPitch into pitchTracker
Extract pitchTracker and throwMeter
Slightly more truthful utils.moveAtSpeed()
2025-02-19 17:13:06 -05:00
Sage Vaillancourt aebbc35bac Add some quick MenuMusic
And extract a bit more pitchTracker logic
2025-02-18 15:50:22 -05:00
Sage Vaillancourt 2d812f2046 Add basic home-run handling
Still needs to pan the camera back from the home run while the runners circle the bases.
Also add a wrapping-pattern.png, though I'm not sure if it's actually used?
2025-02-18 13:58:44 -05:00
Sage Vaillancourt 1bdcc62347 Runners smile instead of frown after scoring. 2025-02-17 20:55:35 -05:00
Sage Vaillancourt c3a9122580 integer -> number 2025-02-17 20:42:44 -05:00
Sage Vaillancourt e20ad0d3ad Add swing-and-a-miss strikes 2025-02-17 20:37:16 -05:00
Sage Vaillancourt 4c9fbcdee7 More advanced statistics and displays. 2025-02-17 20:17:26 -05:00
Sage Vaillancourt 1ccf8765ee Remove some outdated TODOs and comments 2025-02-17 13:26:51 -05:00
Sage Vaillancourt 5c45b7bba0 Add box score and transitions
Add constants defining the top of the outfield wall (not used yet)
Take scores out of mutable global state (that might be just about all of it sewn up)
Finish switching batttingTeam to a TeamId value
2025-02-17 13:21:28 -05:00
Sage Vaillancourt 6007ac971f Add .luacheckrc, remove selene.toml 2025-02-16 18:43:09 -05:00
Sage Vaillancourt db1409d94d selene -> luacheck
Greatly simplifies the Makefile.
2025-02-16 15:14:59 -05:00
Sage Vaillancourt bbaaca4a2d Sort runners/fielders by `y` for draw order
Pulled Fielding:drawFielders() back out into main.lua for this.
Also switching some table-keyed enums to string literal types.
2025-02-15 22:13:37 -05:00
Sage Vaillancourt 51855e13cf Convert main into a Game object.
Much BATTER encapsulation of its dependencies and mutable state. Only the team scores are still global and mutable, but that shouldn't be too hard to fix.
2025-02-15 17:38:56 -05:00
Sage Vaillancourt bb95ef5a63 Add inning count selection to main menu. 2025-02-15 09:40:07 -05:00
Sage Vaillancourt 8943eef73f Add simple main menu (disabled for now)
String names on Logo assets
Add dbg.drawLine() - to use when defining outfield boundaries.
Allow flipped fielder draws.
2025-02-14 15:42:10 -05:00
Sage Vaillancourt e710a79d9c Unified test/setup.lua harness 2025-02-12 23:35:05 -05:00