Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Parallax scrolling in a 2-d side scoller

Author
Message
Mountain Dew Freak
20
Years of Service
User Offline
Joined: 14th Nov 2003
Location:
Posted: 15th Nov 2003 01:20
Probably a stupid question, but I've been working on a simple 2-d side scroller and was wondering if DBC uses layers on any of its 2-d direct draw functions? I have figured out how to make the background scroll from right to left (albiet perhaps crudely), but now I want to add 2 more layers behind the background image at the top of the screen and have them scrolling at slower speeds to add the illusion of depth. Is this possible in the current format I am programming it, or is there perhaps another way? I apologize if the code seems crude, this is one of my first attempts at this.

"It's like a koala bear crapped a rainbow in my brain!" - Capt. Murphy, Sealab 2021
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 15th Nov 2003 12:18
You can make layers with plains, sprites, bitmaps, or 3D objects. Just perform two scrolls on the screen instead of one, or rotate a 3D object like a spinning cylinder with a picture all around it.

Pincho.
Mountain Dew Freak
20
Years of Service
User Offline
Joined: 14th Nov 2003
Location:
Posted: 16th Nov 2003 00:56
Ok, thanks Pincho. At least now I know I'm not insane. The problem I'm still having though is that I tried to paste another image in my main loop that would comprise layer two of the background. Parts of this picture and the main background picture overlap and when I run the program the screen starts flashing severely. Can the pictures not overlap? Or is there some way to achieve this that I'm not aware of? Thanks for the help so far.

"It's like a koala bear crapped a rainbow in my brain!" - Capt. Murphy, Sealab 2021
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Nov 2003 01:23 Edited at: 16th Nov 2003 01:33


What's this part doing? Why is is being used all the time?
It would be slow whatever it is.

How big is the image that you are pasting as a background?

I use copy Bitmap instead of Paste Image. You make a new bitmap, and you copy bitmap 1 to bitmap 0. The copy Bitmap has an x/y offset. By increasing or decreasing the x start/end you create a scroll effect. Better still, you could use textured plains intead, and go for 2D in 3D by moving the camera, that is much faster. Although for parallax you will have to move some plains as well.
Mountain Dew Freak
20
Years of Service
User Offline
Joined: 14th Nov 2003
Location:
Posted: 17th Nov 2003 02:54
Ok Pincho, I removed some redundant code and switched some functions and it seemed to speed things up considerably. I'm still having issues with the screen refresh causing the screen to flash, but I am trying a different approach with this. I have not yet tried using the 3d background with 2d sprites yet. I am going to give this a shot later. So one more question, is there a way when defining sprites to set up a layer order with them? I.e. can you cause certain sprites to appear in the foreground of others when they overlap? Thanks for all the help and suggestions you have given me so far.

"It's like a koala bear crapped a rainbow in my brain!" - Capt. Murphy, Sealab 2021
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Nov 2003 23:53 Edited at: 17th Nov 2003 23:57
Yeah sprites appear in front of each other in numerical order. I think sprite 1 appears in front of all otheres, or it might be the other way round, I only ever use 1 sprite so I'm not sure.

By the way, I didn't say use sprites on a 3D background, I said use textured plains on a 3D background, but if you had DBPro then sprites would be better.

Pincho.
Mountain Dew Freak
20
Years of Service
User Offline
Joined: 14th Nov 2003
Location:
Posted: 18th Nov 2003 00:35
Ok, thanks for all the help Pincho. I used one of your original ideas and simply layered my backgrounds on 3d plains. After some headaches I succeeded in getting the code to work great. Thanks for all the help.

"It's like a koala bear crapped a rainbow in my brain!" - Capt. Murphy, Sealab 2021

Login to post a reply

Server time is: 2024-05-02 08:59:43
Your offset time is: 2024-05-02 08:59:43