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

Username:   Password: 
 RegisterRegister   
 [source] viewing a starry night
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DanShadow




PostPosted: Thu Jan 08, 2004 8:40 pm   Post subject: [source] viewing a starry night

I saw "Rowah" or someone make it, so I decided to post mine.
code:

%Starry Night Thing
var counter, temp : int := 1
var x, y : array 1 .. 200 of int
for i : 1 .. 200
    x (i) := 0
    y (i) := 0
end for
for i : 1 .. 200
    randint (x (i), -400, 1000)
    randint (y (i), -400, 1000)
end for

loop
    setscreen ("offscreenonly")
    View.Update
    Draw.FillBox (0, 0, maxx, maxy, 255)
    delay (200)
    for i : 1 .. 200
        Draw.FillStar (x (i) - 10, y (i) - 10, x (i) + 10, y (i) + 10, 14)
    end for
    if counter = 20 then
        randint (temp, 1, 8)
        counter := 0
    end if
    for i : 1 .. 199
        if temp = 1 then
            x (i) := x (i) - 6
        elsif temp = 2 then
            x (i) := x (i) + 6
        elsif temp = 3 then
            y (i) := y (i) - 6
        elsif temp = 4 then
            y (i) := y (i) + 6
        elsif temp = 5 then
            x (i) := x (i) - 6
            y (i) := y (i) - 6
        elsif temp = 6 then
            x (i) := x (i) + 6
            y (i) := y (i) - 6
        elsif temp = 7 then
            x (i) := x (i) - 6
            y (i) := y (i) + 6
        elsif temp = 8 then
            x (i) := x (i) + 6
            y (i) := y (i) + 6
        end if
    end for
    counter := counter + 1
end loop
Sponsor
Sponsor
Sponsor
sponsor
Maverick




PostPosted: Thu Jan 08, 2004 9:20 pm   Post subject: (No subject)

good, yet laggy.
DanShadow




PostPosted: Thu Jan 08, 2004 9:44 pm   Post subject: (No subject)

Its supposed to be laggy...have you ever looked out at the stars? If so, do you spin your head around wildly and quickly, or slowly gaze across the distances, enjoying the scenery and the moment? Thats why there is "lag". (which is actually a delay Wink )
Maverick




PostPosted: Thu Jan 08, 2004 9:48 pm   Post subject: (No subject)

I'm aware that its a delay.
To me that doesnt look like what you seem to be describing, but thats just me.
santabruzer




PostPosted: Sat Jan 10, 2004 4:32 pm   Post subject: (No subject)

i still say Asian's i think it was Snowflakes. or stars.. was amazing.. wonder if i can find it again ..
shorthair




PostPosted: Tue Jan 13, 2004 7:08 pm   Post subject: (No subject)

Its alright for a turing program , but the fake stars just ruin it , if you wrere to use dots and lines to make some constelations ( spelling) then i would be impressed , but its a good program to build on Very Happy
Rowah




PostPosted: Thu Jan 15, 2004 11:52 am   Post subject: Heh

Hmm my starry night program was different.
Mines was about the stars you see at night, twinkling, appearing, dissappearing. You dont really see stars all yellow, and they ain't that big. My aim was a non-fictive approach, simple yet slick.
Good work but that isn't realistic and its ugly, im sorry but my thumbs are down on this one. Crying or Very sad
DanShadow




PostPosted: Thu Jan 15, 2004 2:02 pm   Post subject: (No subject)

*ouch* man...well, its not supposed to be that realastic anyways... plus, I did this like a couple months after I started programming, and for that time, it was pretty good. hmm..maybe ill have to design a "revenge of the starry night: stab fest" program to impress you Twisted Evil ...but nah, too boring, heh.
santabruzer




PostPosted: Thu Jan 15, 2004 4:32 pm   Post subject: (No subject)

i dunnu.. i did a star program..
code:
    % New type for "stars" or "snow"
    type star :
        record
            x : int
            y : int
            clr : int
        end record

    const maxstar := 500

    % Array for Stars
    var stardot : array 1 .. maxstar of star

    % Generating an Intial Value
    for i : 1 .. maxstar
        stardot (i).x := Rand.Int (0, maxx)
        stardot (i).y := Rand.Int (0, maxy)
        stardot (i).clr := Rand.Int (20, 31)
    end for

    % Regenerating the Intial Value
    proc clearstar (number : int)
        stardot (number).x := maxx
        stardot (number).y := Rand.Int (0, maxy)
        stardot (number).clr := Rand.Int (20, 31)
    end clearstar

    % General Execution Procedure
   
        % Set the screen, and the back color
        setscreen ("offscreenonly")
        colorback (black)
        cls
        loop
            for i : 1 .. maxstar
                % Draw the Star
                drawdot (stardot (i).x, stardot (i).y, stardot (i).clr)

                % Move the Star one left
                stardot (i).x -= 1

                % If Star is offscreen, refresh
                if stardot (i).x < 0 then
                    clearstar (i)
                end if
            end for

            % Refresh the screen
            View.Update
            delay (10)
            cls
        end loop
shorthair




PostPosted: Thu Jan 15, 2004 5:07 pm   Post subject: (No subject)

Thats a much better starry night program ,if you were to connect some constelations into that , or some bitmaps of planets then it wiould be just awsopme , but hte effect taht you give is just amazing Very Happy Very Happy
Rowah




PostPosted: Fri Jan 16, 2004 11:39 am   Post subject: Heh

Santabruzer, your awesome!!
That was l33t..
santabruzer




PostPosted: Sat Jan 17, 2004 11:30 pm   Post subject: (No subject)

and all thanks to the world of records.. Razz.. maybe i should become the "record warrior" or someone like that.... Laughing
PaddyLong




PostPosted: Sun Jan 18, 2004 11:20 am   Post subject: (No subject)

santabruzer wrote:
and all thanks to the world of records.. Razz.. maybe i should become the "record warrior" or someone like that.... Laughing


wait till you learn about objects (classes) Very Happy
AsianSensation




PostPosted: Sun Jan 18, 2004 4:23 pm   Post subject: (No subject)

lol, yeah, structures (or records, as they call it in turing) is like halfway between normal programming and OOP. As PaddyLong said, learn Classes, they will help you so much later on.
santabruzer




PostPosted: Sun Jan 18, 2004 6:39 pm   Post subject: (No subject)

hmmm classes.. i like the sound of it.. i still wish though that turing had a function like TObject....
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 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: