View unanswered posts | View active topics It is currently Fri Dec 27, 2024 11:24 pm



Reply to topic  [ 7 posts ] 
 Checking position beyond scene borders? 
Author Message

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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


Mon Sep 07, 2009 8:54 pm
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post 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 should will be above the scene.

Don't really know if y values drop below zero or not. Haven't really tried it.
Just tested it. It works =).


Mon Sep 07, 2009 9:03 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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.


Mon Sep 07, 2009 9:15 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Checking position beyond scene borders?
SceneMan.Scene.Width or SceneMan.Scene.Height should do the trick.


Mon Sep 07, 2009 9:19 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Mon Sep 07, 2009 10:21 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Mon Sep 07, 2009 10:32 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Checking position beyond scene borders?
CODE CONCATENATION IS AN IMPORTANT PART OF THE LEARNING PROCESS


Mon Sep 07, 2009 10:40 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.021s | 14 Queries | GZIP : Off ]