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.

Newcomers DBPro Corner / any ideas?

Author
Message
punkin111
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location:
Posted: 19th Mar 2003 09:42
hello again everyone,

Does anyone have any ideas how to make an object change color randomly? Not using keys or anything.... What im trying to do is make a rotating cube( which i finally got) but now ive been trying for 2 days now to get the colors to randomly change colors continuously UNTIL the space bar is pushed. So far after two days of going through the tuts and trying several different ways with the timer/randomize functions i havent been able to get it to change continuously.Can someone help me out a bit, even just a guide. maybe im trying the wrong commands to do this. If I am please let me know and ill try that first. After all learning is through trial and error, and im getting the errors lol. Thanks in advance .
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 19th Mar 2003 09:47
How about something like this? :



Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
punkin111
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location:
Posted: 19th Mar 2003 18:43
Thanks Rich...Works exactly the way i wanted now onto the next section and see what i can do lol

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 19th Mar 2003 18:59
Cool - but do you understand how it works?

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 20th Mar 2003 01:48
In my ripples 'n' lights (see the new one!) 20 line programs there are some lights which change colour nice and smoothly. They do that by using sin functions with random coefficients, it's all very complicated. Or not, as the case may be. That's the way to change colours smoothly though, not just random jumps.

Once I was but the learner,
now, I am the Master.
Chiwawa
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 20th Mar 2003 03:30
Quote: "Cool - but do you understand how it works?"


yeah its the most important... cause if you dont understand ... you wont become better.. and then be able to do hmmm...rich coding....


i dont know i did my pun...like it should do..i dont know it there is this expression in english...
punkin111
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location:
Posted: 20th Mar 2003 08:09
Hello,
Actually i dont understand all of it but some of it i kinda have the idea like when i was dooing mine and trying to get it to work I was trying to set up the timer then set up the randomize feature to to randomize colors when the timer gets to a certain time..... Now i was not doing anything like the mseconds, and i really am not sure why you used mseconds, I looked for any type of coding referring to this but did not see anything like that. Im sure its one of those things you end up learning as part of the coding, but right now im not totally sure yet. So maybe ill set it up like this and ask questions about it so i know more about it if thats okay with everyone....

mseconds_until_colour_change = 500...okay I understand that this statment says 500 miliseconds until color change, is that why it is set up as mseconds?

xrotate object 1,wrapvalue(w)
zrotate object 1,wrapvalue(w)...okay these twothe only thing im not sure about is the (w) at the end.... Im starting to understand the wrapvalue part as im reading but when i had mine set up to rotate I had numbers at the end of it instead of the (w)

if timer() > t + mseconds_until_colour_change..... okay the only thing on this is the > sign im not sure about that...i would have ended up putting an equal sign there instead


red = rnd(255)
green = rnd(255)
blue = rnd(255)

color object 1,rgb(red, green, blue)
okay this part i had all screwed up when i was working on it lol... I know what the rnd is....heres the basic way i was trying to set this up...
a=rnd(255,100,150)...or whatever number....Im not sure as of yet why 255 is there but I imagine its the total for the color code..... other than that I kinda understand the concept of this code just not sure why it gets set up this way.... talk about newbies huh lol

Login to post a reply

Server time is: 2024-09-20 01:06:49
Your offset time is: 2024-09-20 01:06:49