Computer now knows how to dive
This commit is contained in:
parent
a4b6e7450f
commit
a2fcbfa7ec
1 changed files with 9 additions and 2 deletions
|
@ -48,12 +48,19 @@ ComputerPlayer = Class{
|
||||||
if ang > math.pi - math.pi / 2 and
|
if ang > math.pi - math.pi / 2 and
|
||||||
ang < math.pi + math.pi / 2 then
|
ang < math.pi + math.pi / 2 then
|
||||||
local needLift = self.plane.body:getY() > 400
|
local needLift = self.plane.body:getY() > 400
|
||||||
|
local needDive = self.plane.body:getY() < 200
|
||||||
if needLift then
|
if needLift then
|
||||||
if ang < math.pi + math.pi / 2 then
|
if ang < math.pi + math.pi / 4 then
|
||||||
wantCw = true
|
wantCw = true
|
||||||
elseif ang > math.pi + math.pi / 2 then
|
elseif ang > math.pi + math.pi / 4 then
|
||||||
wantCcw = true
|
wantCcw = true
|
||||||
end
|
end
|
||||||
|
elseif needDive then
|
||||||
|
if ang < math.pi + math.pi / 4 then
|
||||||
|
wantCcw = true
|
||||||
|
elseif ang > math.pi + math.pi / 4 then
|
||||||
|
wantCw = true
|
||||||
|
end
|
||||||
elseif ang > math.pi then
|
elseif ang > math.pi then
|
||||||
wantCcw = true
|
wantCcw = true
|
||||||
elseif ang < math.pi then
|
elseif ang < math.pi then
|
||||||
|
|
Loading…
Reference in a new issue