Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with making the screen scroll
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
NeutronX




PostPosted: Tue Nov 06, 2007 8:49 pm   Post subject: Help with making the screen scroll

I am making a racing game that requires the cars to move to the right of the screen. When a car gets to a certain point, I want the screen to scroll to the side which means that I can see new parts of the map. It is 2-D and I want the screen to stop scrolling at a certain amount. For example if 2000 pixels where scrolled right, then I want it to stop scrolling. Can someone please send me a code to do tjhis for me? Thanks in advanced!
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Tue Nov 06, 2007 8:55 pm   Post subject: RE:Help with making the screen scroll

Offset all your drawing, and if something is out of screen bounds, don't draw it at all. Very simply really :p
NeutronX




PostPosted: Tue Nov 06, 2007 8:58 pm   Post subject: Re: Help with making the screen scroll

I want the object which i can move myself more to the side and when it goes to a certain point it will scroll the screen
Euphoracle




PostPosted: Tue Nov 06, 2007 9:24 pm   Post subject: RE:Help with making the screen scroll

Then check if it is past XX% of the screen, and if it is, increase your offset to scroll it, and if they are less than YY%|YY<XX of the screen, scroll the other way. I don't really know how to explain it better than that.
NeutronX




PostPosted: Tue Nov 06, 2007 9:26 pm   Post subject: Re: Help with making the screen scroll

ok i understand but how do you increase your offset. Can you give me some code showing exactly what you mean plz?
Euphoracle




PostPosted: Tue Nov 06, 2007 9:29 pm   Post subject: RE:Help with making the screen scroll

var xoffset, yoffset : int
drawfill(xoffset + X, yoffset + Y, ...)

<check if the player is passed XX%>
xoffset += 30
<check if they are less than YY%|YY<XX>
xoffset -= 30

Or something rather. Haven't touched turing in years, sorry :p
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: