Wrap around

Talk about making games.

Wrap around

Postby MrB » Sat May 29, 2010 8:58 am

Hi there

Having got GE working on my ubuntu netbook (and it is more stable than win7 now) I am trying to develop a navigation type game. What I would like to do is have a wrap around on the edges, so if you go off the edge of the world one way, you come back onto the world from the other side.

I tried

Code: Select all
if (x>=10350) x=-10349;
if (x<=-10350)x=10349;


Inside a timer event so it would check the planes position every 100ms but this does not seem to work. I am not sure if I understand what is going on with the x variable so any help would be great.

Oh and my division tutor thing is almost there but I got side tracked like you do.


Thanks all

MrB
MrB
 
Posts: 41
Joined: Sun Jun 14, 2009 8:41 am
Score: 0 Give a positive score

Re: Wrap around

Postby DST » Sun May 30, 2010 5:10 am

I think no one responded because your code appears to be correct.

Perhaps try placing it in draw actor, instead of a timer.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Wrap around

Postby MrB » Sun May 30, 2010 7:27 am

DST wrote:I think no one responded because your code appears to be correct.

Perhaps try placing it in draw actor, instead of a timer.

OK thanks I will give it a go.
MrB
 
Posts: 41
Joined: Sun Jun 14, 2009 8:41 am
Score: 0 Give a positive score

Re: Wrap around

Postby MrB » Sun May 30, 2010 7:55 am

DST wrote:I think no one responded because your code appears to be correct.

Perhaps try placing it in draw actor, instead of a timer.


Thanks worked perfectly in draw actor.
Magic
MrB
 
Posts: 41
Joined: Sun Jun 14, 2009 8:41 am
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest