Wiggleswerth #3 [398.4]
423 rounds, 375 wins, 48 losses, 0 draws
Ships
Pea Shooter II
local turnLeft = false
function Update()
-- Store our angular velocity in a variable to make it easier to use
local angVel = gyro:AngVel()
if ranger:Range() > 0 and not ranger:IsAlly() then
-- We see another ship, stop spinning, start ramming,
-- and remember which way to turn if we lose it again
-- Use the standard thrusters to cancel out our angular velocity
thrustFL:SetThrust(-angVel)
thrustFR:SetThrust(angVel)
thrustBL:SetThrust(angVel)
thrustBR:SetThrust(-angVel)
gun1:Fire()
gun2:Fire()
gun3:Fire()
gun4:Fire()
gun5:Fire()
gun6:Fire()
-- Figure out which way to turn if we lose the ship again
if angVel > 0 then
-- We were spinning left when we saw this target,
-- so we should turn right if we lose it.
turnLeft = false
else
-- We were spinning right when we saw this target,
-- so we should turn left if we lose it.
turnLeft = true
end
else
-- We don't see another ship, spin around to find one
-- Figure out which way to turn
local desiredAngVel = turnLeft and 90 or -90
-- Use the standard thrusters to spin the ship at the desired angular speed.
thrustFL:SetThrust(desiredAngVel - angVel)
thrustFR:SetThrust(angVel - desiredAngVel)
thrustBL:SetThrust(angVel - desiredAngVel)
thrustBR:SetThrust(desiredAngVel - angVel)
end
if not ranger:IsAlly() then
gps:Pos()
end
end
Pea Shooter
local turnLeft = false
function Update()
-- Store our angular velocity in a variable to make it easier to use
local angVel = gyro:AngVel()
if ranger:Range() > 0 and not ranger:IsAlly() then
-- We see another ship, stop spinning, start ramming,
-- and remember which way to turn if we lose it again
-- Use the standard thrusters to cancel out our angular velocity
thrustFL:SetThrust(-angVel)
thrustFR:SetThrust(angVel)
thrustBL:SetThrust(angVel)
thrustBR:SetThrust(-angVel)
gun1:Fire()
gun2:Fire()
gun3:Fire()
gun4:Fire()
gun5:Fire()
gun6:Fire()
-- Figure out which way to turn if we lose the ship again
if angVel > 0 then
-- We were spinning left when we saw this target,
-- so we should turn right if we lose it.
turnLeft = false
else
-- We were spinning right when we saw this target,
-- so we should turn left if we lose it.
turnLeft = true
end
else
-- We don't see another ship, spin around to find one
-- Figure out which way to turn
local desiredAngVel = turnLeft and 90 or -90
-- Use the standard thrusters to spin the ship at the desired angular speed.
thrustFL:SetThrust(desiredAngVel - angVel)
thrustFR:SetThrust(angVel - desiredAngVel)
thrustBL:SetThrust(angVel - desiredAngVel)
thrustBR:SetThrust(desiredAngVel - angVel)
end
end