scrolling game...
Ok, you have a ship in the middle that you fly around the map. It stays in the middle the whole time except when it gets to the edges of the map. When the screen cannot scroll anymore (its at one of the edges) the ship moves which ever way its flying until it hits the edge of the screen too. How would you detect when to start make the ship actually move on the screen? Is there source to a game that performs this?
Thanx,
ViPeR
Examples would be if you have ever played the online game Subspace. Well if your ship gets to the end of the ''big'' maps your ship goes out of the middle of the screen and starts really moving. Or in Total Annihilation when you select a unit and track it (it centers the screen on that unit and follows it), if you track a tank lets say and you move the tank all the way to the end of the map, well the screen stops scrolling and the tank moves out of the center and keeps going that way until it hits the edge of the map. Im giving examples cause this is something that can''t really easily be explained in words :-(
I know what you are talking about, and in fact, it''s in my present scroller right now. you just use an ''if'' statement to see if the screen is at the edge, and if it is, make it so the input makes the ship move. and when the object is moving back, use another ''if'' statement to see whether or not the ship is past or at the center of the screen.
I hope that was clear and helped you out
Gabriel-Dark Angel of Power
"There was a day where there was peace and happiness- the apocalypse."
I hope that was clear and helped you out
Gabriel-Dark Angel of Power
"There was a day where there was peace and happiness- the apocalypse."
Thanks, Ill try that. Its harder to explain what Im talking about than actually doing it I guess :-)
Thanx,
ViPeR
Thanx,
ViPeR
Here is some rough psuedo-ish code that seems a decent enough place to start:
I have no clue if this is how it is normally done.
Notwen
dir = GetMoveDirection ()if (CanScrollScreen (dir)) { ScrollScreen (dir);}else if (CanMoveDir (dir)) { MoveShip(dir);}else { // // Can''t scroll and can''t move. //}boolCanScrollScreen (dir) { switch (dir) { case EAST: curViewX + ScreenSizeX + ScrollAmt < WorldSizeX return true; case WEST: curViewX - ScrollAmt >= 0 return true; // // etc. // } return false;}//// etc.//
I have no clue if this is how it is normally done.
Notwen
Notwenwww.xbox.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement