
-----------------------------------
Saad85
Tue Dec 06, 2005 7:33 pm

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

-----------------------------------
Cervantes
Tue Dec 06, 2005 7:52 pm

Re: help plz.. how do you move the screen?
-----------------------------------
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
Tue Dec 06, 2005 7:53 pm


-----------------------------------
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
Tue Dec 06, 2005 9:10 pm


-----------------------------------
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
Wed Dec 07, 2005 12:46 am


-----------------------------------
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: 

pfft [url=http://www.compsci.ca/v2/viewtopic.php?t=10464] 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
Wed Dec 07, 2005 7:46 am


-----------------------------------
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
Wed Dec 07, 2005 2:18 pm


-----------------------------------
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

There was 1 error.
Sophistication.dll was not found.
So go ahead, sind it away.


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 . . 


v = 5 - (- 3)
v = 5 + 3
v = 8
Viola.

-----------------------------------
Saad85
Wed Dec 07, 2005 6:29 pm


-----------------------------------
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
