diff --git a/src/main.lua b/src/main.lua index 4150541..6f1430a 100644 --- a/src/main.lua +++ b/src/main.lua @@ -766,16 +766,12 @@ end function buttonControlledThrow(thrower, throwFlyMs, forbidThrowHome) local targetBase if playdate.buttonIsPressed(playdate.kButtonLeft) then - throwBall(Bases[Third].x, Bases[Third].y, playdate.easingFunctions.linear, throwFlyMs) targetBase = Bases[Third] elseif playdate.buttonIsPressed(playdate.kButtonUp) then - throwBall(Bases[Second].x, Bases[Second].y, playdate.easingFunctions.linear, throwFlyMs) targetBase = Bases[Second] -- TODO - or shortstop - whoever's closer elseif playdate.buttonIsPressed(playdate.kButtonRight) then - throwBall(Bases[First].x, Bases[First].y, playdate.easingFunctions.linear, throwFlyMs) targetBase = Bases[First] elseif not forbidThrowHome and playdate.buttonIsPressed(playdate.kButtonDown) then - throwBall(Bases[Home].x, Bases[Home].y, playdate.easingFunctions.linear, throwFlyMs) targetBase = Bases[Home] else return false @@ -784,9 +780,12 @@ function buttonControlledThrow(thrower, throwFlyMs, forbidThrowHome) local closestFielder = utils.getNearestOf(fielders, targetBase.x, targetBase.y, function(fielder) return fielder ~= thrower end) + + throwBall(targetBase.x, targetBase.y, playdate.easingFunctions.linear, throwFlyMs) closestFielder.target = targetBase secondsSinceLastRunnerMove = 0 offenseMode = Offense.running + return true end