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

Username:   Password: 
 RegisterRegister   
 Canadian Flag Program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mr. T




PostPosted: Fri Jan 28, 2005 10:37 pm   Post subject: Canadian Flag Program

how do i make the mapleleafs go all the way up to the top?

******************************

var col :int :=16
var a :int :=0
var b :int :=0

setscreen ("graphics:450;250,nobuttonbar,nocursor")
colourback (4)
cls

loop
colour (col)
col+=1
locate (1,20)
put "******************":56..
put "* CANADIAN FLAG! *":56..
put "******************"
delay (100)
exit when col =31
a+=30
b+=30
drawfillmapleleaf (30,210-a,0,240-b,0)
drawfillmapleleaf (420,210-a,450,240-b,0)
drawfillmapleleaf (0+a,0,30+b,30,0)
drawfillmapleleaf (420-a,0,450-b,30,0)
end loop
Sponsor
Sponsor
Sponsor
sponsor
Trojan Man




PostPosted: Sat Jan 29, 2005 12:07 am   Post subject: (No subject)

Ok, This works, except there are some extra leafs at the bottom, just take those out. I only centered ur text and made your leafs start drawing higher.

code:

var col : int := 16
var a : int := 0
var b : int := 0

setscreen ("graphics:450;250,nobuttonbar,nocursor")
colourback (4)
cls

loop
    colour (col)
    col += 1
    locate (1, maxcol div 2 - 9)
    put "******************" ..
    locate (2, maxcol div 2 - 9)
    put "* CANADIAN FLAG! *" ..
    locate (3, maxcol div 2 - 9)
    put "******************" ..
    delay (100)
    exit when col = 31
        a := a + 30
        b := b + 30
        drawfillmapleleaf (30, 250 - a, 0, 280 - b, 0)
        drawfillmapleleaf (420, 250 - a, 450, 280 - b, 0)
        drawfillmapleleaf (0 + a, 0, 30 + b, 30, 0)
        drawfillmapleleaf (420 - a, 0, 450 - b, 30, 0)
end loop
1337_brad




PostPosted: Sat Jan 29, 2005 12:45 am   Post subject: for loop anybody?

I suggest using a for loop, and also the Pic.New function, rather than redrawing the whole thing everytime.

code:

for i: 1..maxy by 30
Draw.FillMapleLeaf(10,i,50,i+30,red)
end for


And just adjust the sizes according to what size you want.
Trojan Man




PostPosted: Sat Jan 29, 2005 1:21 am   Post subject: (No subject)

Yeah, that would be easy to make, i was gonna write that, but I thought the reason he did the way it is, is because he wanted the leafs to appear with the text in kinda like a smooth animation.
1337_brad




PostPosted: Sat Jan 29, 2005 1:26 am   Post subject: View.Update

That is why turing made a sexy command called View.update =D
Trojan Man




PostPosted: Sat Jan 29, 2005 2:08 am   Post subject: (No subject)

I thought leet_brad said creating a separate for loop for the animation, I'm guessing he just meant to use 1 for loop. I tried that and it looks better and shortens the code. Here:

code:

var col : int := 16
var a : int := 0

setscreen ("graphics:450;250,nobuttonbar,nocursor")
colourback (4)
cls

for x : 1 .. maxx div 2 by 30
    colour (col)
    col += 4
    locate (1, maxcol div 2 - 9)
    put "******************" ..
    locate (2, maxcol div 2 - 9)
    put "* CANADIAN FLAG! *" ..
    locate (3, maxcol div 2 - 9)
    put "******************" ..
    a := a + 30
    drawfillmapleleaf (30, 245 - a, 0, 275 - a, 0)
    drawfillmapleleaf (420, 245 - a, 450, 275 - a, 0)
    drawfillmapleleaf (30 + x, 0, 60 + x, 30, 0)
    drawfillmapleleaf (392 - x, 0, 422 - x, 30, 0)
    delay (100)
end for
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  [ 6 Posts ]
Jump to:   


Style:  
Search: