use constraints to make chasey chase; now it is not wiggly

This commit is contained in:
Kistaro Windrider 2024-08-16 19:48:44 -07:00
parent f736f50870
commit 59738d0376
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -1016,10 +1016,9 @@ mknew(chasey, function(ship)
end) end)
function chasey:act() function chasey:act()
local dx = 0 self.xmin = max(primary_ship.x-8, 0)
if (self.x < primary_ship.x) dx=self.thrust self.xmax = min(primary_ship.x + 8, 112 - 8*self.size)
if (self.x > primary_ship.x) dx=-self.thrust return 0, 0, false, self.x - 16 < primary_ship.x and self.x + 16 > primary_ship.x
return dx, 0, false, self.x - 16 < primary_ship.x and self.x + 16 > primary_ship.x
end end
xl_chasey=chasey.new{ xl_chasey=chasey.new{