Tuck bat away if `batter` is `nil`

This commit is contained in:
Sage Vaillancourt 2025-02-24 15:55:59 -05:00
parent 3a465cb02d
commit b928ee3658
1 changed files with 2 additions and 2 deletions

View File

@ -392,8 +392,8 @@ function Game:updateBatting(batDeg, batSpeed)
local batAngle = math.rad(batDeg)
-- TODO: animate bat-flip or something
local batter = self.baserunning.batter
self.state.batBase.x = batter and (batter.x + C.BatterHandPos.x) or 0
self.state.batBase.y = batter and (batter.y + C.BatterHandPos.y) or 0
self.state.batBase.x = batter and (batter.x + C.BatterHandPos.x) or -999
self.state.batBase.y = batter and (batter.y + C.BatterHandPos.y) or -999
self.state.batTip.x = self.state.batBase.x + (C.BatLength * math.sin(batAngle))
self.state.batTip.y = self.state.batBase.y + (C.BatLength * math.cos(batAngle))