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

Username:   Password: 
 RegisterRegister   
 map scrolling
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shyfire




PostPosted: Wed Jul 20, 2005 1:51 pm   Post subject: map scrolling

could some one show me some source on how to make a scrolling map
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Wed Jul 20, 2005 3:30 pm   Post subject: (No subject)

Maybe. What have you got so far? What are your ideas?
Do you know how to use arrays? Types?

The basic idea I think you're looking for is scrolling an environment, or a map, across a screen, as in games such as the helicopter game. It's quite simple, really. You just change the coordinates of each object in the map each time through the loop. For this, however, you'll need an array of objects.
The other way would be to create your environment with it's bottom left corner at (0,0) and just move the entire map. Each object within the map has a coordinate that does not change in relation to the whole map. But since the map is changing, you're objects will be changing as well. This means you don't have to spend CPU time changing a bunch of objects coordinates each time through the loop. On the other hand, when you do collision, you'll have to do some arithmetic to get the coordinates of each object based on the location of the map and the location of the object relative to the map. The first method is easier and more understandable, though it could, perhaps, be slower.
Flikerator




PostPosted: Wed Jul 20, 2005 7:22 pm   Post subject: (No subject)

I wa doing mapping last night for my secret project..I had all the code done and it looked right, but when I went to test it, it was very slow with a picture that is bigger then the screen.... This is on my semi-crappy computer though. When I get my good computer I will try it, however;

If my semi-crappy computer is slow with just the picture, then I fear how slow it will be with tons of pictures and thousands of lines of code.

The way I did the mapping was to make an x and y coordinate. ALL pictures are related to that x and y coordinate. When someone uses the move controls (WASD) the x and y will change according to my movement speed I have set (No hardcoding). Therefore when the x and y change, all the pictures move with it. This also makes it easier when you do calculations because you just compare your xy with the objects xy minus the maps xy.

A little confusing but it works. Im thinking of doing my game in C, its just more powerfull.
Delos




PostPosted: Wed Jul 20, 2005 7:32 pm   Post subject: (No subject)

That was likely just your crappy computer. I just tried my primitive bg-scrolling algorithm running on a bmp around 4000x2000 (~24 megs!) and it ran just as smoothly as a 640x400. Given, there was just one picture, but methinks that this would work equally well with a bunch of pictures on screen at once (perhaps even on onscreen and animated).
Flikerator




PostPosted: Wed Jul 20, 2005 7:53 pm   Post subject: (No subject)

Your right about the multiple picture thing. I tested my old lufia II Remake I was working on with map scrolling/character movment. I took away the restrictions and with less of the picture being drawn it became faster and faster. With a whole bunch of pictures it was just as fast/slow as it always is.

Speed = Speed - # of Pixels being drawn

Ill try it on my fast computer to test it out, when I get a chance.
StarGateSG-1




PostPosted: Wed Jul 20, 2005 11:47 pm   Post subject: (No subject)

The best way to any map is to use a grid system, there are 2 ways to you can go about this, first you can move the map arouns the character like in most 2-D games that are tile based, which is all of them, The other method is to use a method that was created around 3-D and is harder to use with 2-D but it can be done, this is to move the character through a map on screen and then load a new section when you reach close to the edge of the map, I prime example of this is in runescape, unforunately the best method would be to create a 3-D map file that didn't require loading but this is only an option to languages such as C++ and Java, As another note for any game maker wanting to get the the general flow of an Open RPG you could take a look at Runescape, it is full of idea's, but they are all copyrighted so be warned. The best method for 2-D is to create a tile-based map system that shows the entire map on screen and just load the next section at say a exit point, A good example would to to google RMXP or any other RM maker series. That is all I really have to say I hope it can help.
Shyfire




PostPosted: Sun Jul 24, 2005 7:45 pm   Post subject: (No subject)

thank u very much lots of ideas
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  [ 7 Posts ]
Jump to:   


Style:  
Search: