I created a simple line with display.newLine() and a circle with display.newCircle()
My main game loop makes the circle move from line starting point to the line ending point, but it doesn’t follow the line the way I do it:
function(self) if self.x == self.target.x and self.y == self.target.y then target:capture(owner); self.img:removeSelf(); self.arrived = true; self = nil; table.remove(packets, self) else if self.x \< self.target.x then self.x = self.x + self.speed; if self.x \> self.target.x then self.x = self.target.x end else self.x = self.x - self.speed; if self.x \< self.target.x then self.x = self.target.x end end if self.y \< self.target.y then self.y = self.y + self.speed; if self.y \> self.target.y then self.y = self.target.y end else self.y = self.y - self.speed; if self.y \< self.target.y then self.y = self.target.y end end end end
Wondering if there is a convinient way to make a dot follow the line. Have you encounteres similar questions guys?