Fix pitching
This commit is contained in:
parent
9bbd68c302
commit
09e48b65b4
|
@ -518,7 +518,7 @@ function Game:updatePitching(defenseHandler)
|
|||
end
|
||||
|
||||
if pitchTracker.secondsSinceLastPitch > C.PitchAfterSeconds then
|
||||
defenseHandler:pitch()
|
||||
self:pitch(defenseHandler:pitch())
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ function Npc.new(runners, fielders)
|
|||
}, { __index = Npc })
|
||||
end
|
||||
|
||||
function Npc.update() end
|
||||
|
||||
-- TODO: FAR more nuanced NPC batting.
|
||||
---@param ball XyPair
|
||||
---@param pitchIsOver boolean
|
||||
|
|
|
@ -54,12 +54,13 @@ Pitches = {
|
|||
y = gfx.animator.new(C.PitchFlyMs, C.PitchStart.y, C.PitchEndY, playdate.easingFunctions.linear),
|
||||
}
|
||||
end,
|
||||
-- Wobbbleball
|
||||
-- Wobbleball
|
||||
function(accuracy, ball)
|
||||
local missBy = getPitchMissBy(accuracy)
|
||||
return {
|
||||
x = {
|
||||
currentValue = function()
|
||||
return getPitchMissBy(accuracy)
|
||||
return missBy
|
||||
+ C.PitchStart.x
|
||||
+ (10 * math.sin((ball.yAnimator:currentValue() - C.PitchStart.y) / 10))
|
||||
end,
|
||||
|
|
|
@ -48,7 +48,7 @@ function UserInput:pitch()
|
|||
if powerRatio then
|
||||
local throwFly = C.PitchFlyMs / powerRatio
|
||||
if throwFly and not self.buttonControlledThrow(throwFly, true) then
|
||||
userPitch(throwFly, accuracy)
|
||||
return userPitch(throwFly, accuracy)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue