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! / 2D Shootet: Having The backgrounds change every minute or so

Author
Message
Riz
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location:
Posted: 8th Dec 2008 05:20
Hey whats im a DBpro newbie, im currently making a 2D shooter and ive got everything to work but what i cant figure out what to do is how to have the background change every couple of minutes or so can anyone help?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 9th Dec 2008 02:01
Hi,

Assuming your background is a sprite, try something like this in your main loop:

(You would have to load all the different background images in consecutive image numbers):



Your signature has been erased by a mod
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 17th Dec 2008 05:11
What i would do is just in the loop start a variable that adds one every loop and then when that reaches a certain number change the sprite number to the next sprite and set the variable to 0 again like this



see?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th Dec 2008 15:44
Also, you would want Wait# and Sprite# to be integers - the sprite number has to be an integer and it makes more sense for Wait# to be one since you're never adding a decimal to it.

Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 17th Dec 2008 17:31
Windowskiller:

oh good point i didn't think of the speed part haha.

Bmaczero:

What do you mean? isn't # that a integer?????
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th Dec 2008 23:46
No, # indicates a float (a decimal number). For integers, just don't use any sign.

Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 18th Dec 2008 19:41
oh i had it backwords in my mind im dumb sorry lol

Login to post a reply

Server time is: 2024-04-25 21:59:47
Your offset time is: 2024-04-25 21:59:47