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

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




PostPosted: Tue Mar 18, 2008 8:29 am   Post subject: Beginning graphics assignment

This is a first step to doing graphics in Turing.
This we are using drawfilloval to create different oval sizes and locations
and then creating rendom ints to make the eyes and mouth move in random positions.


*****Assignment******

Create a face that the eyes and mouth move into random positions.





/*
Name : Dave Angus
Date : March 4th, 2008
Title : gassi1.t
Description : This program was designed to draw a cartoon and animate
it so that they eyes and mouth rendomly move
*/
var num : int


loop

cls
/*This is the back ground for the face*/
drawfilloval (325, 200, 150, 150, yellow)
/*This is the white part in the eyes*/
drawfilloval (255, 245, 40, 40, white)
drawfilloval (400, 245, 40, 40, white)
/*This is the nose*/
drawfilloval (325, 200, 15, 20, brown)
/*Blow is the two dots in the nose*/
drawfilloval (317, 190, 2, 2, black)
drawfilloval (330, 190, 2, 2, black)

/* This is the random movement for the left eye. */

randint (num, 1, 4)

if num = 1 then
drawfilloval (255, 245, 15, 15, black)
elsif num = 2 then
drawfilloval (230, 260, 15, 15, black)
elsif num = 3 then
drawfilloval (260, 230, 15, 15, black)
elsif num = 4 then
drawfilloval (240, 220, 15, 15, black)
end if


/* This is the random movment for the right eye. */


randint (num, 1, 4)

if num = 1 then
drawfilloval (400, 245, 15, 15, black)
elsif num = 2 then
drawfilloval (375, 260, 15, 15, black)
elsif num = 3 then
drawfilloval (425, 230, 15, 15, black)
elsif num = 4 then
drawfilloval (390, 220, 15, 15, black)
end if



/* This is the background for the mouth. */

randint (num, 1, 4)

if num = 1 then
drawfilloval (325, 125, 50, 20, 5)
elsif num = 2 then
drawfilloval (325, 125, 50, 20, 5)
elsif num = 3 then
drawfilloval (325, 125, 50, 20, 5)
elsif num = 4 then
drawfilloval (325, 125, 50, 20, 5)
end if

/* This is the random movement for the mouth. */

randint (num, 1, 4)

if num = 1 then
drawfilloval (325, 120, 45, 15, 9)

elsif num = 2 then
drawfilloval (325, 115, 45, 10, 9)

elsif num = 3 then
drawfilloval (325, 135, 45, 5, 9)

elsif num = 4 then
drawfilloval (325, 125, 45, 20, 9)

end if

delay (500)
end loop
Sponsor
Sponsor
Sponsor
sponsor
DaveAngus




PostPosted: Tue Mar 18, 2008 9:14 am   Post subject: RE:Beginning graphics assignment

Comments or suggestions are appreciated!
DaveAngus




PostPosted: Tue Mar 18, 2008 9:24 am   Post subject: RE:Beginning graphics assignment

This is a simple assignment to show students too
BigBear




PostPosted: Tue Mar 18, 2008 2:13 pm   Post subject: Re: Beginning graphics assignment

It is amuses me that you have posted a lot of your assignments. First you should code tag when posting because it makes code easier to read because it doesn't ignore spaces. Just put
code:

[code]
%code here
[/code]
or
[syntax="turing"]
%code here
[/syntax]

Also when using graphics mode (anything that isn't text) then you should use View.Set("offscreenonly") and View.Update. View.Set("offscreenonly") creates another screen and you must view it using View.Update this will remove flashing. Just press F10 while in turing or search the turing section of this site to learn more.
DaveAngus




PostPosted: Wed Mar 19, 2008 8:13 am   Post subject: RE:Beginning graphics assignment

Thanks for the help BigBear
And im just posting my assignments because I enjoy getting feedback on how I could improve them to become better at programming.
I am not looking at doing this as a career but I enjoy doing it as a pass time!
Tallguy




PostPosted: Tue Apr 15, 2008 9:54 am   Post subject: RE:Beginning graphics assignment

good start, but the mouth doesn't look all that great, the eyes do but not the mouth
DaveAngus




PostPosted: Thu Apr 17, 2008 8:07 pm   Post subject: RE:Beginning graphics assignment

haha yea. It was whipped together in like one hour on my second day doing any programming what-so-ever. So I know its pretty lame! hahaha I should really update it to something better!
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  [ 7 Posts ]
Jump to:   


Style:  
Search: