Merge pull request #7 from gl00my/sailboat_speed

better handling
This commit is contained in:
Sergei Mozhaisky 2019-11-19 19:03:47 +02:00 committed by GitHub
commit 84767c677a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,10 +128,10 @@ local sailstep = function(self)
end
else -- paddle
local paddleacc
if longit_speed < 1.0 and ctrl.up then
paddleacc = 0.5
elseif longit_speed > -1.0 and ctrl.down then
paddleacc = -0.5
if longit_speed < 2 and ctrl.up then
paddleacc = 1
elseif longit_speed > -2 and ctrl.down then
paddleacc = -1
end
if paddleacc then accel=vct.add(accel,vct.multiply(hdir,paddleacc)) end
end
@ -148,9 +148,9 @@ local sailstep = function(self)
end
-- rudder
if ctrl.right then
rudder_angle = max(self.rudder_angle-20*dtime,-RUDDER_LIMIT)
rudder_angle = max(self.rudder_angle-40*dtime,-RUDDER_LIMIT)
elseif ctrl.left then
rudder_angle = min(self.rudder_angle+20*dtime,RUDDER_LIMIT)
rudder_angle = min(self.rudder_angle+40*dtime,RUDDER_LIMIT)
end
end
end