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

Username:   Password: 
 RegisterRegister   
 help plz.. how do you move the screen?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Saad85




PostPosted: Tue Dec 06, 2005 7:33 pm   Post subject: help plz.. how do you move the screen?

i had planned on making a mini-car overhead view racing game but i just realised, i dont know how i would move the map to be centered on the car even after it moves. it's possible that i move everything BUT the car to keep it in the window but i was wondering if there was a better way of doing it. thx
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Dec 06, 2005 7:52 pm   Post subject: Re: help plz.. how do you move the screen?

Saad85 wrote:
it's possible that i move everything BUT the car to keep it in the window but i was wondering if there was a better way of doing it. thx


Yep. Leave the car in the middle, and move the map around the car. So if the car's x velocity is 5, move the map by -5.
RedRogueXIII




PostPosted: Tue Dec 06, 2005 7:53 pm   Post subject: (No subject)

umm what you said is pretty redundant, your gonna have to redraw the map everytime you move.
But scrolling jobs is pretty easy, first you put down your graphics all layed out, dont worry they can be placed offscreen, then you have a scrolling variable for x and y, for every picture that will scroll you minus the scrolling variables, so if scrollx and scrolly = 0 then you would be at the bottom left corner. then all you have to do is to draw the racecar in the center and voila it will always be centered while the map moves around it.(on keypress right then scrollx += whatever, and so on yadayaya.)
BTW::anyone ever doen a scrolling tutorial? it would be pretty easy.
GlobeTrotter




PostPosted: Tue Dec 06, 2005 9:10 pm   Post subject: (No subject)

It really only gets difficult to draw the map around the player in a top-down is iff the player can rotate, and the camera rotates with the player. This is nearly impossible to do in turing while keeping frame-rates fast enough. If the player doesn't have to rotate it's quite doable.

Check this out for an example: http://www.compsci.ca/v2/viewtopic.php?t=5538
Saad85




PostPosted: Wed Dec 07, 2005 12:46 am   Post subject: (No subject)

GlobeTrotter wrote:
It really only gets difficult to draw the map around the player in a top-down is iff the player can rotate, and the camera rotates with the player. This is nearly impossible to do in turing while keeping frame-rates fast enough. If the player doesn't have to rotate it's quite doable.

Check this out for an example: http://www.compsci.ca/v2/viewtopic.php?t=5538


pfft my game is better than yours!(jks)

hmm.. i dont think it would be hard at all. cant you just set a speed and use cos/cosd and sin/sind to determine how much your map would move?

the only problem i might have is making the ai-controlled enemies move.. how would i go about that?
DIIST




PostPosted: Wed Dec 07, 2005 7:46 am   Post subject: (No subject)

Well if you try just the speed higher, the movement will be more choppy! It wont be as smooth and clear. As for the enemies, do you plan to move them diagonally and in any direction, or just side to side and forward depending on the user?
jamonathin




PostPosted: Wed Dec 07, 2005 2:18 pm   Post subject: (No subject)

Saad85 wrote:
hmm.. i dont think it would be hard at all. cant you just set a speed and use cos/cosd and sin/sind to determine how much your map would move?

You very well could, i mean why not? If you can make your player move with cosd/sind (yes you want the 'd' ones), then why not move the map.
It's not like you're going to get an error like
Complation Error wrote:

There was 1 error.
Sophistication.dll was not found.

So go ahead, sind it away.

Saad85 wrote:

the only problem i might have is making the ai-controlled enemies move.. how would i go about that?


The best thing i can compare this to is Diablo II. I mean, all your guy does is run around at "maxx div 2" and "maxy div 2" while everything moves around him.

If I am running UPWARDS at a velocity of 5, and the AI guy is also running UPWARDS at a velocity of 3, then we are approching at a velocity of 2.

And the same thing for the opposite, subtract the two. If MY velocity is +5 and the computer's velocity is -3, then . .

code:

v = 5 - (- 3)
v = 5 + 3
v = 8

Viola.
Saad85




PostPosted: Wed Dec 07, 2005 6:29 pm   Post subject: (No subject)

k, thx guys im getting it now


and thuvs, yes i want both me and the opponents to be able to move in any direction
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: