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

Username:   Password: 
 RegisterRegister   
 THe Moon Animaion
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
enimirahi




PostPosted: Sun Apr 19, 2009 5:32 pm   Post subject: THe Moon Animaion

Hey so I have a question with this. IN this program I am supposed to draw a moon that move across a sky which has some starts. The background is black and after a random flying object will move across the screen just like the moon also did. But the differnece is that the reandom flying object will later dissapear after.


Turing:

%Eni Elezi
%April 20,2009
%Qustion #1 of Animation Assignment
%Draws a moon that moves across a star-lit sky then adds a flying object that moves across the screen from one space to another at a certain speed

colorback (7)

%Moon
var m: int := 100 - 50
var n : int := 100 - 50
loop
    m -= 9
    n -= 3
    Draw.FillOval (88, 88, 88, 55, grey)
    Draw.FillOval (77, 88, 77, 55, white)
    delay (5000)
    cls
end loop


%Stars
Draw.FillStar (33, 270, 100, 200, 14)
Draw.FillStar (300, 220, 200, 300, 14)
Draw.FillStar (100, 248, 200, 300, 14)

%Flying object that moves across the screen
var x : int := 100 - 10
var y : int := 100 - 10
loop
    x -= 2
    y -= 1
    Draw.FillBox (x, y, x - 20, y - 20, 9)
    delay (5000)
    cls
end loop


Mod Edit: Remember put the code inside the syntax tags!
code:
[syntax="turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Sun Apr 19, 2009 6:08 pm   Post subject: Re: THe Moon Animaion

Well, I don't know what the actual problem is, since you neglected to use the template that you got when you started the thread...

However, I will say that you are clearly completely missing the point of a loop. When you put code in a loop, the program will repeatedly run that code until you tell it to exit. if you don't tell it to exit, it will repeat FOREVER. you need you use an exit when line to make it get out of the loop.

Incidentally, When you copied the turing code box, you were supposed to actually put your code where it said "code here"...
BigBear




PostPosted: Sun Apr 19, 2009 7:37 pm   Post subject: RE:THe Moon Animaion

OK so drawing the moon or any other object is the same then you can use a for loop

Turing:
for i :1..maxx
%code
end for


A for loop will act like a loop and exit when i has taken the values from 1 to maxx

so if you put i in the loop you could see all the values

then you need to draw your object and to make it move you can put the x position 10+i and it will move from the left side of the screen to the right

Try editing your code and post it again if you need more help
enimirahi




PostPosted: Sun Apr 19, 2009 8:14 pm   Post subject: RE:THe Moon Animaion

k thanks
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  [ 4 Posts ]
Jump to:   


Style:  
Search: