Wierd thing on position and the map seam
While I was working on my grappling gun, I discovered an interesting thing about the map seam and positioning on the map. If you use Lua to place an actor outside the range of the map (and the map is wrapping) and if the actor is controlled, the screen will go around the map and to that position, as if there is no wrapping. What I'm thinking (but I don't have enough tests to prove) is that the actor is technicly out-of-bounds, but physics are normal and its position is fixed an instant after. A way that I figured to get around this:
Code:
self.pointer = <object>;
self.movetopos = Vector(0,0);
if SceneMan.SceneWrapsX == true then
if self.movetopos.X > SceneMan.SceneWidth then
self.pointer.Pos = Vector(self.movetopos.X - SceneMan.SceneWidth,self.movetopos.Y);
elseif self.movetopos.X < 0 then
self.pointer.Pos = Vector(SceneMan.SceneWidth + self.movetopos.X,self.movetopos.Y);
else
self.pointer.Pos = self.movetopos;
end
else
self.pointer.Pos = self.movetopos;
end
What this does is that the desired new position for the object is put in, the Lua automticly checks if the map wraps and the position is out-of-bounds, and to manually wrap it if so. What I'm wondering is why something like this isn't already in place in CC's engine to prevent screen problems.