Data Realms Fan Forums http://45.55.195.193/ |
|
Help with checking for scene wraps http://45.55.195.193/viewtopic.php?f=73&t=19471 |
Page 1 of 1 |
Author: | goduranus [ Mon Aug 09, 2010 9:27 am ] |
Post subject: | Help with checking for scene wraps |
For my flying saucer craft, I want to check for scene wrapping, then find the closest direction to get above the enemy brain, but the following segment code doesn't work and messes up the other functions of my lua, can anyone help me find what's wrong? Code: local Nav = Distance to the enemy's brain if (SceneMan:SceneWrapsX() == true) then -- if scene wraps if (Nav > SceneMan:GetSceneWidth()/2 then -- and distance to enemy brain is more than half of map width Nav = Nav - SceneMan:GetSceneWidth() -- go the other direction elseif Nav < -SceneMan:GetSceneWidth()/2 then -- or if distance to enemy brain is more than half of map width the other way Nav = Nav + SceneMan:GetSceneWidth() -- go the other direction end end |
Author: | Grif [ Mon Aug 09, 2010 7:44 pm ] |
Post subject: | Re: Help with checking for scene wraps |
Use SceneMan.SceneWidth rather than SceneMan:GetSceneWidth(); you might be getting errors with userdata from a function or something like that. Also, how are you getting Nav? If you're using a distance finder function, you're going to be trying to subtract a vector by a constant. I'm assuming that you're just using self.Pos.X - brain.Pos.X, or something along those lines? |
Author: | goduranus [ Tue Aug 10, 2010 1:57 pm ] |
Post subject: | Re: Help with checking for scene wraps |
Thanks, I think it worked. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |