Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I've decided to be a little less of a jerk (credits)
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mazer




PostPosted: Wed May 18, 2005 10:56 am   Post subject: I've decided to be a little less of a jerk (credits)

I'm a big fan of the ice cream cakes.
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Wed May 18, 2005 12:53 pm   Post subject: (No subject)

Very, very nice. I like the concept of making the dots darker, the further back they are. I'm not sure how you made it so that two stars always flew together, I'm not sure if thats an error ot what, but it looks good.

Nice text fading. Very well done.

Oh, and I also like the widescreen view. Smile
Notoroge




PostPosted: Wed May 18, 2005 8:31 pm   Post subject: (No subject)

WTF? I swear I could actually see depth in the scrolling stars background. Shocked Crazy.
Bacchus




PostPosted: Wed May 18, 2005 9:06 pm   Post subject: (No subject)

ya i kno what you mean. pretty sure its just the different speeds of the starts moving so it looks like some are farther away
Mazer




PostPosted: Wed May 18, 2005 10:12 pm   Post subject: (No subject)

Notoroge wrote:
WTF? I swear I could actually see depth in the scrolling stars background. Shocked Crazy.


That's one of the things I pointed out in the tutorial. Each star is given a random speed, and based on that speed, they are drawn with an appropriate colour.
A star that appears to be moving slowly (due to perspective) is further away from our viewpoint, and thus the light it emits should be less bright than a star that is closer to us.

I've been doing the same thing since my snowflake programs earlier that year (and before). So you like it? Wink
Bacchus




PostPosted: Thu May 19, 2005 6:13 am   Post subject: (No subject)

very much so, which did you do to make it a bit darker? R, B, or G? im guessing that u used RGB commands cause it doesnt look like its enouph for a set color
Mazer




PostPosted: Thu May 19, 2005 6:44 am   Post subject: (No subject)

Well, actually yeah I did use Turings colours. Usually, it's too much trouble to have to use the RGB colours in Turing. From what I remember, colours 16 to 31 will fade from black to white.
Bacchus




PostPosted: Thu May 19, 2005 10:28 pm   Post subject: (No subject)

ah i see, i was thinking like the first 12 or something like that, and for some reason i was thinking you were using a yellow or some sort...
Sponsor
Sponsor
Sponsor
sponsor
Notoroge




PostPosted: Fri May 20, 2005 1:06 pm   Post subject: (No subject)

I decided to see if I could get the same effect. How does this look? Smile

Turing:
View.Set ("offscreenonly, title:stars, graphics:300;300, nobuttonbar")
colourback (black)
cls
Draw.FillBox (0, 0, maxx, 59, gray + 10)
Draw.FillBox (0, maxy - 59, maxx, maxy, gray + 10)

var stars : int := 600 %number of stars
var deleay : int := 25 %put whatever delay you want here
var x, y, speed, colours : array 1 .. stars of int
for i : 1 .. stars
    x (i) := Rand.Int (0, maxx)
    y (i) := Rand.Int (60, maxy - 60)
    speed (i) := Rand.Int (2, 4)
    for r : 2 .. 4
        if speed (i) = r then
            colours (i) := RGB.AddColour (r / 4, r / 4, r / 4)
        end if
    end for
    Draw.Dot (x (i), y (i), colours (i))
end for

loop
    for i : 1 .. stars
        if x (i) >= 0 then
            x (i) := x (i) - speed (i)
            Draw.Dot (x (i) + speed (i), y (i), black)
            Draw.Dot (x (i), y (i), colours (i))
        elsif x (i) < 0 then
            Draw.Dot (x (i), y (i), colours (i))
            x (i) := maxx + 2
            y (i) := Rand.Int (60, maxy - 60)
        end if
    end for
    delay (deleay)
    View.Update
end loop

Update: Whoah! I just moved the "View.Update" to somewhere else after realizing that it was somewhere that was using unecessary resources and now it flies (super speed). So fast, in fact, that I ended up having to add a delay to it. Otherwise everything just zooms accross the screen. Laughing

Update2: Shocked I updated the code to show 200 stars at a time, and no slowdowns yet, whereas before it would slow down and bog the system at 40 stars. Very Happy
The real power of View.Update is demostrated here. Wink

Update3: Oh snap, you want to see crazy? Run the code at 600 stars (the new default Wink)
[Gandalf]




PostPosted: Fri May 20, 2005 2:06 pm   Post subject: (No subject)

Very nice - did you make it the same way that Coutsos did?

Try it at 2000 stars Very Happy. Or better yet, 4000000 heh... It slowed down a bit at that point.
Notoroge




PostPosted: Fri May 20, 2005 2:09 pm   Post subject: (No subject)

I didn't copy his code. I looked at the binary and decided to see if I could make the same thing. I recall him saying he didn't use RGB colours so I purposefully did, just that will change the code a bit.

And I did run it at 100000, no slowdown. But it does look wierd. Eh
Notoroge




PostPosted: Fri May 20, 2005 2:20 pm   Post subject: (No subject)

Since I have no life, I decided to add one that exits when you hit any key (both compiled and source). Uh, sorry for the quasi thread-hijacking. Confused


stars.rar
 Description:
asdf

Download
 Filename:  stars.rar
 Filesize:  230.93 KB
 Downloaded:  148 Time(s)

Bacchus




PostPosted: Fri May 20, 2005 3:27 pm   Post subject: (No subject)

ya thats really nice and you get the same nice effect. who knows i may use a similar idea in a game of mine in the futur. wont copy ne code. ill do it from scratch later, but the color-distance thing is good to remmeber
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: