Decrease BaseHitbox to fix tag-outs
Rename tryToThrowOut() to tryToMakeOut()
This commit is contained in:
parent
9df836e0bf
commit
841b7e3fea
16
src/main.lua
16
src/main.lua
|
@ -281,7 +281,7 @@ local elapsedSec = 0
|
|||
local crankChange = 0
|
||||
local acceleratedChange
|
||||
|
||||
local BaseHitbox = 13
|
||||
local BaseHitbox = 10
|
||||
--- Returns the base being touched by the runner at (x,y), or nil, if no base is being touched
|
||||
function isTouchingBase(x, y)
|
||||
for _, base in ipairs(Bases) do
|
||||
|
@ -410,9 +410,10 @@ function getBaseOfStrandedRunner()
|
|||
|
||||
return farRunnersBase, farDistance
|
||||
end
|
||||
--- Returns x,y of the throw target
|
||||
|
||||
--- Returns x,y of the out target
|
||||
---@return number|nil, number|nil
|
||||
function getNextThrowTarget()
|
||||
function getNextOutTarget()
|
||||
-- TODO: Handle missed throws, check for fielders at target, etc.
|
||||
local targets = getForcedOutTargets()
|
||||
if #targets ~= 0 then
|
||||
|
@ -420,13 +421,14 @@ function getNextThrowTarget()
|
|||
end
|
||||
|
||||
local baseCloseToStrandedRunner = getBaseOfStrandedRunner()
|
||||
-- TODO: If another fielder is closer, throw it to them, instead
|
||||
if baseCloseToStrandedRunner then
|
||||
return baseCloseToStrandedRunner.x, baseCloseToStrandedRunner.y
|
||||
end
|
||||
end
|
||||
|
||||
function tryToThrowOut(thrower)
|
||||
local targetX, targetY = getNextThrowTarget()
|
||||
function tryToMakeAnOut(thrower)
|
||||
local targetX, targetY = getNextOutTarget()
|
||||
if targetX ~= nil and targetY ~= nil then
|
||||
local nearestFielder = getNearestOf(fielders, targetX, targetY)
|
||||
nearestFielder.target = xy(targetX, targetY)
|
||||
|
@ -476,10 +478,10 @@ function updateFielders()
|
|||
then
|
||||
outRunner(i)
|
||||
playdate.timer.new(750, function()
|
||||
tryToThrowOut(fielder)
|
||||
tryToMakeAnOut(fielder)
|
||||
end)
|
||||
else
|
||||
tryToThrowOut(fielder)
|
||||
tryToMakeAnOut(fielder)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue