Computer Science Canada

Pyramid

Author:  TheFerret [ Tue Mar 09, 2004 6:51 pm ]
Post subject:  Pyramid

This is a cool program that I have made, I made it at school during free time but forgot about it, I made this one at home and will put the other one up tommorow at school... The one at school is better...

UPDATED

code:
/* Travis Baker
March 9, 2004
Pyramid
*/
setscreen ("graphics:400;400")
var x, y, x1, y1, col, col1, num : int
x := 0
y := 0
x1 := 400
y1 := 400
col := 1
col1 := 255
put "Enter number (Below 255)"
get num
cls
loop
    for i : 1 .. 400
        delay (1)
        x += 1
        y += 1
        x1 -= 1
        y1 -= 1
        col += 2
        if col >= 255 then
            col := 1
        end if
        drawbox (x, y, x1, y1, col)
        x += 1
        y += 1
        x1 -= 1
        y1 -= 1
        %col1-=num
        col1 := num + 23
        if col1 <= 1 or col1 >= 255 then
            col1 := 255
        end if
        drawbox (x, y, x1, y1, col1)
    end for
end loop



Author:  Paul [ Tue Mar 09, 2004 7:28 pm ]
Post subject: 

Hehe, it can be seen as a pyramid or tunnel Very Happy what were you trying to do with
col1 and
code:

col1-=num
if col1<=1 then
col1:=num+23
end if

?

Author:  TheFerret [ Tue Mar 09, 2004 7:34 pm ]
Post subject: 

It is a mistake, I am updating the main one...

Author:  TheFerret [ Wed Mar 10, 2004 7:53 am ]
Post subject: 

This is the version that I made at school...

code:
var x,y,x1,y1,col,space:int
x:=0
y:=0
x1:=400
y1:=400
col:=1
space:=1
put "Enter spacing (Below 256)"
get space
loop
col:=1
for i:1..400
drawbox(x,y,x1,y1,col)
x+=1
y+=1
x1-=1
y1-=1
col+=1
if col>=255  or col<=0 then
col:=1
end if
drawbox(x,y,x1,y1,col)
x+=1
y+=1
x1-=1
y1-=1
col+=space
if col>=255 or col<=0 then
col:=1
end if
end for
end loop

Author:  jonos [ Wed Mar 10, 2004 8:01 am ]
Post subject: 

thats some pretty neat stuff. if you make it into an animation you could use it to clear your screen if you are making a longer prog or game.

Author:  TheFerret [ Wed Mar 10, 2004 9:59 am ]
Post subject: 

I made an updated version...

code:
col1 := 255
changex := 1
changex1 := 1
changey1 := 1
changey := 1
put "Enter number (Below 255)"
get num
cls
loop
    for i : 1 .. 400
        delay (25)
        x += changex
        y += changex1
        x1 += changex1
        y1 += changey1
        x += 1
        y += 1
        x1 -= 1
        y1 -= 1
        col += 2
        if col >= 255 then
            col := 1
        end if
        drawbox (x, y, x1, y1, col)
        x += 1
        y += 1
        x1 -= 1
        y1 -= 1
        %col1-=num
        col1 := num + 23
        if col1 <= 1 or col1 >= 255 then
            col1 := 255
        end if
        drawbox (x, y, x1, y1, col1)
        if x >= maxx then
            changex *=-1
            elsif x1>=maxx then
            changex1*=-1
            elsif y>=maxy then
            changey*=-1
            elsif y1>=maxy then
            changey1*=-1
            elsif x<=0 then
            changex*=-1
            elsif x1<=0 then
            changex*=-1
            elsif y<=0 then
            changey*=-1
            elsif y1<=0 then
            changey1*=-1
            end if
        end for
    end loop

Author:  magicman [ Wed Mar 10, 2004 10:27 am ]
Post subject: 

That's pretty good man.. Twisted Evil Evil or Very Mad
nice job
Very Happy
r u a newby? Shocked

Author:  jonos [ Wed Mar 10, 2004 11:55 am ]
Post subject: 

nice job... keep up the good work and nice animations. now you should try to make something a little more complicated with circles and other shapes. next time post the whole code so we don't have to add in the declaration of variables.

Author:  TheFerret [ Wed Mar 10, 2004 4:23 pm ]
Post subject: 

I thought I copied it all but I guess I didn't, sorry...

Author:  the_short1 [ Wed Mar 10, 2004 5:26 pm ]
Post subject: 

ok.... but a delay of (10) is needed.... i guess the comp you made this with is Extremely slow...

also.... maybe post as a .t file... (attachment) so its ez to open up


other wise cool looking.. but i agree with jonos.... try to make something with more shapes and designs....... great start to turing programming..

Next thing... watch u make a pong game... :O

Author:  white_dragon [ Wed Mar 10, 2004 5:44 pm ]
Post subject: 

lol! pong is da first newby games made. i made one 2

Author:  the_short1 [ Wed Mar 10, 2004 5:51 pm ]
Post subject: 

i skiped the nooby programs (except kevin da shorts cool visuals) and when straigh to pac man... (taht was in nov, started in sep)...


i think half the ppl taht finished compsci gr. 10 ( with an average grade) either made or tried to malke a pong game...

Author:  apomb [ Wed Mar 10, 2004 8:07 pm ]
Post subject: 

Well, in gr 10 i made a 007 program ..wait it had the same bouncy ball thing like pong nvmnd but ne ways ... nice visuals .. a little simple, but good for a nooob, keep it up and we'll see some great things!


: