Data Realms Fan Forums http://45.55.195.193/ |
|
Checking position beyond scene borders? http://45.55.195.193/viewtopic.php?f=73&t=16459 |
Page 1 of 1 |
Author: | numgun [ Mon Sep 07, 2009 8:54 pm ] |
Post subject: | Checking position beyond scene borders? |
How can I check if an object it past the scene's border? I have this thing that is supposed to spawn an actor when destroyed, but if it gets destroyed by going over the border and dying from that, it will crash the game instantly. I'm thinking a simple function making the appearing actor to move just to the border and getting destroyed like it normally would might fix the problem. Not sure though. Can I use something like?: if self.pos < SceneMaxHeight then self.Pos = SceneMaxHeight; end |
Author: | Kyred [ Mon Sep 07, 2009 9:03 pm ] |
Post subject: | Re: Checking position beyond scene borders? |
Position (0,0) is the top left corner of the scene. If the y-value is negative, then the object Just tested it. It works =). |
Author: | numgun [ Mon Sep 07, 2009 9:15 pm ] |
Post subject: | Re: Checking position beyond scene borders? |
No not the top border, the bottom one. And possibly the side borders on non-XWrap maps. I'm asking is there a way to get the value with a statement that would work for every map instead of just one. |
Author: | TheLastBanana [ Mon Sep 07, 2009 9:19 pm ] |
Post subject: | Re: Checking position beyond scene borders? |
SceneMan.Scene.Width or SceneMan.Scene.Height should do the trick. |
Author: | Grif [ Mon Sep 07, 2009 10:21 pm ] |
Post subject: | Re: Checking position beyond scene borders? |
SceneMan.SceneHeight and SceneMan.SceneWidth actually. Just use if self.Pos.X > SceneMan.SceneWidth then and height/y for past the bottom edge. |
Author: | TheLastBanana [ Mon Sep 07, 2009 10:32 pm ] |
Post subject: | Re: Checking position beyond scene borders? |
Actually both of them work >:[ But yes, if you want to leave out a SINGLE DOT then you go right on ahead. |
Author: | Grif [ Mon Sep 07, 2009 10:40 pm ] |
Post subject: | Re: Checking position beyond scene borders? |
CODE CONCATENATION IS AN IMPORTANT PART OF THE LEARNING PROCESS |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |