Computer Science Canada

Crazy Flag!

Author:  mike200015 [ Wed Jan 26, 2005 7:02 pm ]
Post subject:  Crazy Flag!

i want to move the rectangles on either side of the canadian flag, so they switch places, but the problem in here is they cover the screen when they move, how do i make the 2 rectangles in the flag move to the opposite side and still show wats underneath??

Please help!
thnx!!

code:
%%Animation #3 - Moving Rectangles

var leftcol, centrecol, rightcol, maplecol : int
var lrectx, lrectx2, rrectx, rrectx2 : int

lrectx := 0
lrectx2 := 115
rrectx := 385
rrectx2 := 500

setscreen ("graphics:500;275,nobuttonbar")
locate (4, 1)
    put "Enter left rectangle colour: " ..
    get leftcol
    delay (200)
    put "Enter flag centre colour: " ..
    get centrecol
    delay (200)
    put "Enter right rectangle colour: " ..
    get rightcol
    delay (200)
    put "Enter maple leaf colour: " ..
    get maplecol

drawfillbox (lrectx, 0, lrectx2, maxy, leftcol)
    delay (300)
    drawfillbox (rrectx, 0, rrectx2, maxy, rightcol)
    delay (300)
    drawfillbox (115, 0, maxx - 115, maxy, centrecol)
    delay (300)
    drawfillmapleleaf (137, 10, 367, maxy - 10, maplecol)
    delay (1000)
    loop
        drawfillbox (lrectx, 0, lrectx2, maxy, leftcol)
        drawfillbox (rrectx, 0, rrectx2, maxy, rightcol)
        lrectx += 5
        lrectx2 += 5
        rrectx -= 5
        rrectx2 -= 5
        exit when lrectx = 385 and lrectx2 = 500 and rrectx = 0
            and rrectx2 = 115
        delay (100)
    end loop

Author:  person [ Wed Jan 26, 2005 7:41 pm ]
Post subject: 

i think this is how u do it


%%Animation #3 - Moving Rectangles

var leftcol, centrecol, rightcol, maplecol : int
var lrectx, lrectx2, rrectx, rrectx2 : int

lrectx := 0
lrectx2 := 115
rrectx := 385
rrectx2 := 500

setscreen ("graphics:500;275,nobuttonbar")
locate (4, 1)
put "Enter left rectangle colour: " ..
get leftcol
delay (200)
put "Enter flag centre colour: " ..
get centrecol
delay (200)
put "Enter right rectangle colour: " ..
get rightcol
delay (200)
put "Enter maple leaf colour: " ..
get maplecol
setscreen ("offscreenonly")
loop
View.Update
drawfillbox (lrectx, 0, lrectx2, maxy, leftcol)
drawfillbox (rrectx, 0, rrectx2, maxy, rightcol)
drawfillbox (115, 0, maxx - 115, maxy, centrecol)
drawfillmapleleaf (137, 10, 367, maxy - 10, maplecol)
drawfillbox (0, 0, 115, maxy, centrecol)
drawfillbox (385, 0, 500, maxy, centrecol)
drawfillbox (lrectx, 0, lrectx2, maxy, leftcol)
drawfillbox (rrectx, 0, rrectx2, maxy, rightcol)
delay (20)
lrectx += 5
lrectx2 += 5
rrectx -= 5
rrectx2 -= 5
exit when lrectx = 385 and lrectx2 = 500 and rrectx = 0
and rrectx2 = 115
delay (100)
end loop

Author:  mike200015 [ Wed Jan 26, 2005 8:18 pm ]
Post subject: 

hey thanx person! it worked, thats wat i wanted it to do.


: