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

Username:   Password: 
 RegisterRegister   
 help with stars please
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
dani190




PostPosted: Mon Dec 19, 2005 4:48 pm   Post subject: help with stars please

ok so this is the stars code
code:

var row,column:int
loop
    %---------------------------------------------------------------------------STARS
    delay (100)
    randint (row, 1, 20)
    randint (column, 1, 80)
    locate (row, column)
    color (black)
    put "*"



    %----------------------------------------------------------------------------STARS END
end loop

so thats how i want my stars to work
but this is my current code with the house etc
code:

setscreen ("graphics:max,max,offscreenonly")




colorback (blue)
cls





var c : int
var y1 : int
var x1 : int
var countx, county : int
var row : int
var column : int
var a, b : int
var x2, y2 : int
var x, y : int
var Pic1 : int
var Pic2 : int
var YOval : int


a := 420
b := 50
c := blue
countx := 10
county := 7
x := 1300
y := 600
x1 := 1300
y1 := 400

var h : array 1 .. 4 of int := init (150, 400, 270, 20)    %Roof
var d : array 1 .. 4 of int := init (250, 250, 400, 20)    %Roof




loop

    %Smoke start
    YOval := 430


    Draw.FillOval (230, YOval, 10, 10, grey)

    YOval := -3 %or whatever

    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 440


    Draw.FillOval (230, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (1)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 450


    Draw.FillOval (230, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (1)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 460


    Draw.FillOval (230, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (1)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 430


    Draw.FillOval (220, YOval, 10, 10, grey)

    YOval := -3 %or whatever

    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 440


    Draw.FillOval (220, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (10)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 450


    Draw.FillOval (220, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (10)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 460


    Draw.FillOval (220, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (10)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if

    YOval := 470


    Draw.FillOval (220, YOval, 10, 10, grey)

    YOval := -3 %or whatever
    delay (10)
    if YOval > maxy then % If the circle is above the top of the screen
        YOval := 250 %Restarts the circle at the chimney
    end if
    %Smoke End



    Draw.FillBox (150, 50, 400, 250, brightred)     %house box
    Draw.FillBox (401, 50, 620, 160, brightgreen)   %Garage
    Draw.FillBox (420, 50, 601, 140, brightblue)    %Garage Door

    Draw.FillBox (350, 140, 300, 170, grey)         %house window Right side
    Draw.FillBox (200, 140, 250, 170, grey)         %house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)            %Grass in front
    Draw.FillBox (250, 110, 200, 50, grey)          %Door
    drawfilloval (240, 80, 5, 5, black)             %Door Knob
    drawfillbox (205, 250, 250, 400, red)           %Chiminy

    Draw.FillBox (a, b, 601, 50, black)             %Garage part2
    Draw.FillPolygon (h, d, 3, green)               %Roof of house
    Draw.ThickLine (350, 170, 300, 170, 5, black)   %Rail of right window (top)
    Draw.ThickLine (300, 138, 300, 170, 5, black)   %Rail of right window (left side)
    Draw.ThickLine (350, 138, 300, 138, 5, black)   %Rail of right window (Botten)
    Draw.ThickLine (350, 140, 350, 170, 5, black)   %Rail of right window (right side)
    %----------------------------------------------------------------------------------
    Draw.ThickLine (200, 170, 250, 170, 5, black)   %Rail of left window (top)
    Draw.ThickLine (250, 140, 250, 170, 5, black)   %Rail of left window (right side)
    Draw.ThickLine (200, 140, 250, 140, 5, black)   %Rail of left window (bottem)
    Draw.ThickLine (200, 140, 200, 170, 5, black)   %Rail of left window (left side)









    a := a
    b := b + 5


    exit when b > 130
    View.Update


    delay (150)

    cls
    colorback (c)
    drawfilloval (x1, y1, 20, 20, yellow)

    if b > 1000
            then
        drawfillbox (475, 120, 480, 125, white)
        drawfillbox (520, 120, 525, 125, white)
        if b = 130
                then
            Draw.FillBox (420, 50, 601, 140, brightblue)
        end if
    end if




end loop


loop

    Draw.FillBox (150, 50, 400, 250, brightred)     %house box
    Draw.FillBox (401, 50, 620, 160, brightgreen)     %Garage
    Draw.FillBox (420, 50, 601, 140, brightblue)     %Garage Door
    Draw.FillBox (350, 140, 300, 170, yellow)         %house window Right side
    Draw.FillBox (200, 140, 250, 170, yellow)         %house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)            %Grass in front
    Draw.FillBox (250, 110, 200, 50, grey)          %Door
    drawfilloval (240, 80, 5, 5, black)             %Door Knob
    drawfillbox (205, 250, 250, 400, red)           %Chiminy
    Draw.FillBox (a, b, 601, 50, black)             %Garage part2
    drawfillbox (475, 120, 480, 125, white)
    drawfillbox (520, 120, 525, 125, white)
    Draw.FillPolygon (h, d, 3, green)               %Roof of house
    Draw.ThickLine (350, 170, 300, 170, 5, black)       %Rail of right window (top)
    Draw.ThickLine (300, 138, 300, 170, 5, black)     %Rail of right window (left side)
    Draw.ThickLine (350, 138, 300, 138, 5, black)     %Rail of right window (Botten)
    Draw.ThickLine (350, 140, 350, 170, 5, black)     %Rail of right window (right side)
    %----------------------------------------------------------------------------------
    Draw.ThickLine (200, 170, 250, 170, 5, black)     %Rail of left window (top)
    Draw.ThickLine (250, 140, 250, 170, 5, black)     %Rail of left window (right side)
    Draw.ThickLine (200, 140, 250, 140, 5, black)     %Rail of left window (bottem)
    Draw.ThickLine (200, 140, 200, 170, 5, black)     %Rail of left window (left side)

    View.Update
    delay (50)     %Controls how fast the sun moves!


    colorback (blue)


    cls


    drawfilloval (x, y, 20, 20, yellow)


    exit when x = 0
    x := x - countx
    y := y - county
    if y > 500 then
        county := 0
        if x < 300 then
            county := +10

            a := a
            b := b - 8

            exit when b > 130


        end if

    end if


end loop





x := 2
y := 300
countx := 10
county := 7


loop



    View.Set ("graphics:max,max,offscreenonly")

    Draw.FillBox (150, 50, 400, 250, brightred)     %house box
    Draw.FillBox (401, 50, 620, 160, brightgreen)     %Garage
    Draw.FillBox (420, 50, 601, 140, brightblue)     %Garage Door

    Draw.FillBox (350, 140, 300, 170, grey)         %house window Right side
    Draw.FillBox (200, 140, 250, 170, grey)         %house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)            %Grass in front
    Draw.FillBox (250, 110, 200, 50, grey)          %Door
    drawfilloval (240, 80, 5, 5, black)             %Door Knob
    drawfillbox (205, 250, 250, 400, red)           %Chiminy
    Draw.FillBox (a, b, 601, 50, black)             %Garage part2
    Draw.FillPolygon (h, d, 3, green)               %Roof of house
    Draw.ThickLine (350, 170, 300, 170, 5, black)       %Rail of right window (top)
    Draw.ThickLine (300, 138, 300, 170, 5, black)     %Rail of right window (left side)
    Draw.ThickLine (350, 138, 300, 138, 5, black)     %Rail of right window (Botten)
    Draw.ThickLine (350, 140, 350, 170, 5, black)     %Rail of right window (right side)
    %----------------------------------------------------------------------------------
    Draw.ThickLine (200, 170, 250, 170, 5, black)     %Rail of left window (top)
    Draw.ThickLine (250, 140, 250, 170, 5, black)     %Rail of left window (right side)
    Draw.ThickLine (200, 140, 250, 140, 5, black)     %Rail of left window (bottem)
    Draw.ThickLine (200, 140, 200, 170, 5, black)     %Rail of left window (left side)


    a := a
    b := b - c
    c := 0
    if b = 100 then
        c := 0
    end if




    View.Update


    delay (50)     %Controls how fast the moon moves!


    colorback (black)



    cls

    delay (100)
    randint (row, 1, 20)
    randint (column, 1, 158)
    locate (row, column)
    color (white)
    put "*"




    drawfilloval (x, y, 20, 20, white)


    exit when x > 1500
    x := x + countx
    y := y + county
    if y > 500 then
        county := 0
        if x > 750 then
            county := -7
        end if
    end if






end loop

and in this it only is using 1 star
how can i get my house and other stuff to get the stars like the first program has. so a bunch at a time but not always in the same place like the first code i showed
Also how can i get rid of those car lights after the garage has gone down again?
hope you guys can help thx!
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Mon Dec 19, 2005 5:38 pm   Post subject: Re: help with stars please

dani190 wrote:

code:

var row,column:int
loop
    %---------------------------------------------------------------------------STARS
    delay (100)
    randint (row, 1, 20)
    randint (column, 1, 80)
    locate (row, column)
    color (black)
    put "*"



    %----------------------------------------------------------------------------STARS END
end loop

Learn to embrace functions:
code:

loop
    locate (Rand.Int (1, maxrow), Rand.Int (1, maxcol))
    put "*"
end loop
dani190




PostPosted: Mon Dec 19, 2005 7:53 pm   Post subject: (No subject)

thanks, so much man this really helps Exclamation Exclamation
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: