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.

DarkBASIC Professional Discussion / Colour cycle effect ?

Author
Message
jamma
22
Years of Service
User Offline
Joined: 21st Nov 2002
Location:
Posted: 11th Feb 2003 18:14
What's the best way to achieve a slow colour-cycle for, say, a glowing object that goes from bright yellow to dark red, in-game ? I'd like to see future DBPro's support a command like this, just a few rgb values to cycle through. Ideal for glowing LEDs or simple flashing lights. Or am I missing something....
Arrow
22
Years of Service
User Offline
Joined: 1st Jan 2003
Location: United States
Posted: 11th Feb 2003 19:26
Here's an idea,

do
a = 255
b = 0

color object 1, (a,b,0)

a = a - 5
b = b + 5
loop

Am I a butterfly dreaming I'm a man?
Or a bowling ball dreaming I'm a plate of samishi?
Never assume that what you see or feel is real.
jamma
22
Years of Service
User Offline
Joined: 21st Nov 2002
Location:
Posted: 11th Feb 2003 20:49
That's sort of what I've been experimenting with, but I need it within the game loop, cycling consistently. Never quite looks right.

TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 11th Feb 2003 21:17
The easy way would be for DBPRO would consider making a timer interupt, in which you could set the timer to call a funtion to take care of little stuff on the side. As it is now you are going to have to optimize your code and check the timer yourself to rotate your colors. Which is not an easy task since you can't count cpu cycles in db. If you want this then you are going to have to work at and use multiple small funtions that all use the same amount of time to return(In order to keep things running smoothly). But hey I might be full of crap too, cause I'm a old school binary guy myself.

TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 11th Feb 2003 21:21
It all boils down to the ART of threading. You should consider writing all your code in the way that is explained in the N64 programmers reference manual. It describes the art somewhat and explains better than I am able, cause I have brain to word problems, hehe.

Fluffy Paul
22
Years of Service
User Offline
Joined: 16th Dec 2002
Location: United Kingdom
Posted: 12th Feb 2003 00:03
How about this in your program:



What this leaves you with is how many "cycles per second" your last game cycle took. What you need to do is specify things in terms of "things per second". In your colour shift example this would be RGB value change per second. Let's say you want to move the RGB value by 50 every second.
In every game cycle you'll need to execute the following code (remembering to put the initial state value outside the loop:



Ending a sentence with a French word is so passé
jamma
22
Years of Service
User Offline
Joined: 21st Nov 2002
Location:
Posted: 12th Feb 2003 10:26
Ta for the feedback. Hope it's something they plan to implement...it is a very games-specific function and even the likes of Amos had it.

Login to post a reply

Server time is: 2025-05-18 23:16:58
Your offset time is: 2025-05-18 23:16:58