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

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




PostPosted: Thu Dec 15, 2005 7:27 pm   Post subject: help with changing progarm from day to night

hey guys i want to know how to change my program from night time to day time, i know you need to copy the code over again but i dont really know how to use the if and end if commands to get rid of the night and go to day
This is my code:



code:

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



colorback (black)
var row, column : int
var x : int
x := 1
cls





var v : int
var u : int
var c : int
var count : int
var g : int
var k : int


loop


    %-------------------------------------------------------------------------HOUSE
    g := 1300
    k := 600
    %              x1  y1  x2   y2    color
    Draw.FillBox (150, 50, 400, 250, brightred)     %Main house box
    Draw.FillBox (501, 50, 620, 150, brightgreen)     %Garage
    Draw.FillBox (520, 50, 601, 140, brightblue)     %Garage Door

    Draw.FillBox (350, 140, 300, 170, grey)     %Main house window Right side
    Draw.FillBox (200, 140, 250, 170, grey)     %Main house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)     % Road in front
    Draw.FillBox (250, 110, 200, 50, grey)



    delay (1)
    %--------------------------------------------------------------------------^^^^^HOUSE END
    %--------------------------------------------------------------------------ROOF                                                                         ROOF
    var h : array 1 .. 4 of int := init (150, 400, 270, 10)
    var d : array 1 .. 4 of int := init (250, 250, 400, 10)
    Draw.FillPolygon (h, d, 3, 1)
    %---------------------------------------------------------------------------ROOF END
    loop
        %---------------------------------------------------------------------------STARS

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


        %----------------------------------------------------------------------------STARS END
        %----------------------------------------------------------------------------moon start
        g := g - 15
        k := 1 + 500


        Draw.FillOval (g, k, 30, 30, white)
        View.Update


        Draw.FillOval (g, k, 30, 30, black)
        exit when g = 1

        %-----------------------------------------------------------------------------moon end

end loop if g := 0





    end loop
end loop


loop
   

    colorback (blue)
    cls

    %-------------------------------------------------------------------------HOUSE
    g := 1300
    k := 600
    %              x1  y1  x2   y2    color
    Draw.FillBox (150, 50, 400, 250, brightred)     %Main house box
    Draw.FillBox (501, 50, 620, 150, brightgreen)     %Garage
    Draw.FillBox (520, 50, 601, 140, brightblue)     %Garage Door

    Draw.FillBox (350, 140, 300, 170, grey)     %Main house window Right side
    Draw.FillBox (200, 140, 250, 170, grey)     %Main house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)     % Road in front
    Draw.FillBox (250, 110, 200, 50, grey)



    delay (1)
    %--------------------------------------------------------------------------^^^^^HOUSE END
    %--------------------------------------------------------------------------ROOF                                                                         ROOF
    var h : array 1 .. 4 of int := init (150, 400, 270, 10)
    var d : array 1 .. 4 of int := init (250, 250, 400, 10)
    Draw.FillPolygon (h, d, 3, 1)
    %---------------------------------------------------------------------------ROOF END
    loop
        %---------------------------------------------------------------------------STARS

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


        %----------------------------------------------------------------------------STARS END
        %----------------------------------------------------------------------------moon start
        g := g - 15
        k := 1 + 500


        Draw.FillOval (g, k, 30, 30, white)
        View.Update


        Draw.FillOval (g, k, 30, 30, black)
        exit when g = 1

        %-----------------------------------------------------------------------------moon end

    end loop
end loop
 


giving it just in case it is needed
Sponsor
Sponsor
Sponsor
sponsor
alvini




PostPosted: Thu Dec 15, 2005 8:50 pm   Post subject: Re: help with changing progarm from day to night

dani190 wrote:
hey guys i want to know how to change my program from night time to day time, i know you need to copy the code over again but i dont really know how to use the if and end if commands to get rid of the night and go to day
This is my code:



code:

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



colorback (black)
var row, column : int
var x : int
x := 1
cls





var v : int
var u : int
var c : int
var count : int
var g : int
var k : int


loop


    %-------------------------------------------------------------------------HOUSE
    g := 1300
    k := 600
    %              x1  y1  x2   y2    color
    Draw.FillBox (150, 50, 400, 250, brightred)     %Main house box
    Draw.FillBox (501, 50, 620, 150, brightgreen)     %Garage
    Draw.FillBox (520, 50, 601, 140, brightblue)     %Garage Door

    Draw.FillBox (350, 140, 300, 170, grey)     %Main house window Right side
    Draw.FillBox (200, 140, 250, 170, grey)     %Main house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)     % Road in front
    Draw.FillBox (250, 110, 200, 50, grey)



    delay (1)
    %--------------------------------------------------------------------------^^^^^HOUSE END
    %--------------------------------------------------------------------------ROOF                                                                         ROOF
    var h : array 1 .. 4 of int := init (150, 400, 270, 10)
    var d : array 1 .. 4 of int := init (250, 250, 400, 10)
    Draw.FillPolygon (h, d, 3, 1)
    %---------------------------------------------------------------------------ROOF END
    loop
        %---------------------------------------------------------------------------STARS

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


        %----------------------------------------------------------------------------STARS END
        %----------------------------------------------------------------------------moon start
        g := g - 15
        k := 1 + 500


        Draw.FillOval (g, k, 30, 30, white)
        View.Update


        Draw.FillOval (g, k, 30, 30, black)
        exit when g = 1

        %-----------------------------------------------------------------------------moon end

end loop if g := 0





    end loop
end loop


loop
   

    colorback (blue)
    cls

    %-------------------------------------------------------------------------HOUSE
    g := 1300
    k := 600
    %              x1  y1  x2   y2    color
    Draw.FillBox (150, 50, 400, 250, brightred)     %Main house box
    Draw.FillBox (501, 50, 620, 150, brightgreen)     %Garage
    Draw.FillBox (520, 50, 601, 140, brightblue)     %Garage Door

    Draw.FillBox (350, 140, 300, 170, grey)     %Main house window Right side
    Draw.FillBox (200, 140, 250, 170, grey)     %Main house window Left side
    Draw.FillBox (1800, 1, 1, 50, green)     % Road in front
    Draw.FillBox (250, 110, 200, 50, grey)



    delay (1)
    %--------------------------------------------------------------------------^^^^^HOUSE END
    %--------------------------------------------------------------------------ROOF                                                                         ROOF
    var h : array 1 .. 4 of int := init (150, 400, 270, 10)
    var d : array 1 .. 4 of int := init (250, 250, 400, 10)
    Draw.FillPolygon (h, d, 3, 1)
    %---------------------------------------------------------------------------ROOF END
    loop
        %---------------------------------------------------------------------------STARS

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


        %----------------------------------------------------------------------------STARS END
        %----------------------------------------------------------------------------moon start
        g := g - 15
        k := 1 + 500


        Draw.FillOval (g, k, 30, 30, white)
        View.Update


        Draw.FillOval (g, k, 30, 30, black)
        exit when g = 1

        %-----------------------------------------------------------------------------moon end

    end loop
end loop
 


giving it just in case it is needed










hey dani try this:


loop


colorback (blue)
cls

%-------------------------------------------------------------------------HOUSE
g := 1300
k := 600
% x1 y1 x2 y2 color
Draw.FillBox (150, 50, 400, 250, brightred) %Main house box
Draw.FillBox (501, 50, 620, 150, brightgreen) %Garage
Draw.FillBox (520, 50, 601, 140, brightblue) %Garage Door

Draw.FillBox (350, 140, 300, 170, grey) %Main house window Right side
Draw.FillBox (200, 140, 250, 170, grey) %Main house window Left side
Draw.FillBox (1800, 1, 1, 50, green) % Road in front
Draw.FillBox (250, 110, 200, 50, grey)



delay (1)
%--------------------------------------------------------------------------^^^^^HOUSE END
%--------------------------------------------------------------------------ROOF ROOF
var h : array 1 .. 4 of int := init (150, 400, 270, 10)
var d : array 1 .. 4 of int := init (250, 250, 400, 10)
Draw.FillPolygon (h, d, 3, 1)
%---------------------------------------------------------------------------ROOF END
loop

%----------------------------------------------------------------------------moon start
g := g - 15
k := 1 + 500


Draw.FillOval (g, k, 30, 30, yellow)
View.Update


Draw.FillOval (g, k, 30, 30, blue)
exit when g = 1

%-----------------------------------------------------------------------------moon end

end loop
end loop
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  [ 2 Posts ]
Jump to:   


Style:  
Search: