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