2d background (Parallax Scrolling) help?

well i’ve been messing around with the lwjgl, i have to say its very nice, space invader example is ace, i was just trying to get a background from my sprites flying around a black canvas.

how and what is the best way to achieve this, i was thinking like to have a grid of quads all over with textures to create a map, or maybe have an extreamly large quad the size of the level with a massive bitmap stuck to it?

not sure how to go about this, looking to make a level for a 2d scroller.
any help or pointers in the right direction would be appreciated. ??? ??? ???

i think a two dimansional array with the map data
(what kind of tile/background-texture it is), and one which holds the texture ids to use would be fine.
the position of these tiles on the screen depends on the players position in this 2d world and the position in the array.
this way you can also pretty easy calculate which part of the level is on the screen, and only draw that bit.
also the mapdata-array avoids having duplicate tiles over and over.

this should work for almost all 2d tiule-based scroller - games and do it fast.

Sry for my bad english… im a little bit drunk ;D

Greets

Dosenbier

Your avatar is too big. It’s >400kb.

And… well it’s basically the same like doing it in Java2D…

http://www.gamedev.net/reference/articles/article1256.asp

thanks for the tips and links i’ll have a look. so basically background moves not the camera or is it the other way round?

ps. sorry for the avatar, i’ll get rid of it asap, did’nt realise the loading delay it would cause, i had it cached.

i found a tutorial for lwjgl, for loading very big backgrounds it may help others in need, just a question would this type of style be good for a 2d scroll shooter because it made for a worms style game?

http://www.vermin-exterminator.de/tutorials/lwjgl/opengl_openal/bigTexture.html

Well, I got broad band… so no big deal. However, the avatar was more than 100 times bigger than mine… and I have a true color thingy with alpha there :wink:

would this type of style be good for a 2d scroll shooter
because it made for a worms style game?

I took a look. Well, it’s not true that opengl can only handle textures up to 512x512 - you can ask the card which sizes are supported (my gf2mx goes up to 2048x2048 ).

For a scroller it would be a rather bad thing to do, because the levels are usually pretty large. Use tiling instead. A 512x512 texture can hold 64 64x64 tiles. That’s usually enogh for a whole level.