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

Username:   Password: 
 RegisterRegister   
 small graphics program
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fehrge




PostPosted: Wed May 04, 2005 10:57 am   Post subject: small graphics program

This was a small assignment for school.

code:

%George Fehr
%April 21, 2005
%program to make a border of circles and other graphics

setscreen ("graphics:800;600,position:100;100,nocursor")

colorback (black)
cls

%declare variables to draw the border
var x : int := 20
var y : int := 0
var x2 : int := 20
var y2 : int := 20
var x3 : int := 300
var y3 : int := 150
var col1 : int
var col2 : int
var col3 : int
var font := Font.New ("arial:50")
var iNum : int

%draw the bottom line of circles
for i : 1 .. 20
    %random color
    col1 := Rand.Int (1, 255)
    y := 20
    %draw circle
    Draw.FillOval (x, y, 20, 20, col1)
    delay (10)
    %move the x
    x := x + 40
end for

%draw the left line of circles
for i : 1 .. 20
    col1 := Rand.Int (1, 255)
    x := 20
    Draw.FillOval (x, y, 20, 20, col1)
    y := y + 40
    delay (10)
end for

%draw the right line of circles
for i : 1 .. 20
    col1 := Rand.Int (1, 255)
    x := 780
    Draw.FillOval (x, y2, 20, 20, col1)
    y2 := y2 + 40
    delay (10)
end for

%draw the top line of circles
for i : 1 .. 20
    col1 := Rand.Int (1, 255)
    y := 580
    Draw.FillOval (x2, y, 20, 20, col1)
    x2 := x2 + 40
    delay (10)
end for

for a : 1 .. 50
    col2 := Rand.Int (1, 255)
    Font.Draw ("Graphics Challenge 1", 60, 350, font, col2)
    delay (10)
    View.Update
end for

for b : 1 .. 40
    iNum := Rand.Int (1, 4)
    col3 := Rand.Int (1, 255)
    if iNum = 1 then
        Draw.FillBox (x3, y3, x3 + 100, y3 + 100, col3)
        delay (100)
        View.Update
        Draw.FillBox (x3, y3, x3 + 100, y3 + 100, 7)
    elsif iNum = 2 then
        Draw.FillStar (x3, y3, x3 + 100, y3 + 100, col3)
        delay (100)
        View.Update
        Draw.FillStar (x3, y3, x3 + 100, y3 + 100, 7)
    elsif iNum = 3 then
        Draw.FillMapleLeaf (x3, y3, x3 + 100, y3 + 100, col3)
        delay (100)
        View.Update
        Draw.FillMapleLeaf (x3, y3, x3 + 100, y3 + 100, 7)
    elsif iNum = 4 then
        Draw.FillOval (x3 + 50, y3 + 50, 50, 50, col3)
        delay (100)
        View.Update
        Draw.FillOval (x3 + 50, y3 + 50, 50, 50, 7)
    end if
end for
delay (1000)
Font.Draw ("By: George Fehr", 150, 250, font, 2)
Sponsor
Sponsor
Sponsor
sponsor
dann_west




PostPosted: Wed May 04, 2005 12:50 pm   Post subject: Re: small graphics program

[That couldnt of been slower.. You should improve it. Nick says it was good in his post but he exited it before it was done cause he thought it was boring!
Twisted Evil
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: