Jump to content
  • Advertisement
Sign in to follow this  
Rifle_001

Making a sidescroller

This topic is 4127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hullo, I'm making a 2D arcade- like sidescroller and I want to know how to make the background scroll by using DirectX 9 (I already know the DirectInput part I just need a method of scrolling the background). I don't know if I should put the whole level on one bitmap and then load it because that would use a lot of processing power (maybe). And also what does the -> operator do (or what is it used for)?

Share this post


Link to post
Share on other sites
Advertisement
its still the same tile map concept. just use bigger tiles if ya want. Have you a routine for drawing all the other tiles allready?

Share this post


Link to post
Share on other sites
Actually I meant (although this article did help me with a problem I would of had in the near future) how should I make the bitmap for my level? Should I cut the long picture of the whole level into chunks and then reassemble them at runtime or something else? And then how should I cut the picture into tiles? Can I do it at runtime and then place them as needed with the smooth scrolling from the article or is this too expensive in terms of performance? And my question about the -> operator is still unanswered.

Share this post


Link to post
Share on other sites
Hidden
With today's computer technology, it doesn't really matter if you use one big background image for your level, or if you generate it from tiles. In my opinion, it is more elegant to use tiles, as you'll be able to design your own level editor where you can place tiles and make thousands of variations. If you use one big background image instead, you're sort of limited to that image only. But in terms of processing power, don't worry about it. Your computer can handle it. :)

The -> operator is used when handling variables inside a struct that has been passed to a function. Like this:

struct PlayerPosition {
int x;
int y;
} mystruct;

DoSomethingWith(&mystruct);

function DoSomethingWith(struct PlayerPosition *pointer) {
pointer->x = 10; // we are accesing x inside mystruct
pointer->y = 10; // we are accessing y inside mystruct
}


Share this post


Link to post
Quote:
Original post by Rifle_001
And also what does the -> operator do (or what is it used for)?


The arrow operator dereferences a pointer, you use it when working with pointers to class or struct objects, to gain access to their public methods or data members. It does the same thing as dereferencing the object pointer in this way: (*object).method()

These two code segments do the exact same thing.



Point* p;

p = new Point(0, 0);

p->x = 10;









Point* p;

p = new Point(0, 0);

(*p).x = 10;






So, as you can see, using the arrow operator makes the code looks less ugly. :P

[Edited by - CandleJack on May 26, 2007 2:25:18 PM]

Share this post


Link to post
Share on other sites
If you use the tile method, you can make your level more interactive. Also, when you want to modify your engine, it wont be as much of a hassle.

Share this post


Link to post
Share on other sites
While you're at it, here's what you can do to build your level. I'm in a hotel room right now and feeling a bit generous/bored. :P


First, develop a theme and some plans for your level, taking not of particular elements and objects that will be used (things like furniture, and doors, and tapestries... everything that you're actually going to see for this level).

Once you have a theme and a good plan for your level, then you can simply use a paint program with layering (like Photoshop, PSP, or Paint.net). You can then build an adequately sized image that contains all the above elements and objects that you'll be using to build the level.

-- The first layer is of a solid color that will be source-colorkeyed away.

-- The second layer is a plain grid. It has a pixel, or maybe a little cross that's a few pixels in size, for every corner of every tile. You can then use that to align your images as tiles. This is just a tool for you to use, nothing more.

-- Use the next few layers for sketching, probably one "sketch" layer for every object. You can also make some "color sketch" layers just to play with the coloring a bit. It helps.

-- The next layers are "cleanup" layers, and once again, you can use one for every object if you want to. And you can then choose to either color in the objects in these layers, or make new layers (above or below; below can be very useful) and use those for your color.

Now you can disable your grid and sketch layers, and flatten your image so that each object is clearly visible. And then you can run your image through a tool like Mappy or something similar, and then you can build your level using all the tiles you got from this image, and you can build as many maps out of that one image as you like. The tool you use should explain how to load the maps you make with it.

And as for the tiling itself, there are plenty of articles out there for this. Diana Gruber's book is good, there are articles on this site that are good... The algorithm for drawing a tilemap is still basically the same.

Anyway, hopefully that helps you in some way or another. :P

Share this post


Link to post
Share on other sites
Quote:
Original post by ROBERTREAD1
If you use tiles, you can't do destructible scenery.
Eh? Sure you can. You just have to represent it in a different way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!