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

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




PostPosted: Fri Apr 17, 2009 4:05 pm   Post subject: Animation help

HI so i had this project where i had to create a ball thats supposed to bunce down staris and go out of the screen. The problem is the ball doesn't tuch the stairs at the perfect spot plz can u try loading the code that i made and see for yourself and later telling me what must be doen it fix it

Turing:
%Makes the ball bounce
%Stairs
Draw.Line (0, 320, 66, 320, blue)
Draw.Line (65, 320, 65, 220, blue)
Draw.Line (66, 220, 200, 220, blue)
Draw.Line (199, 220, 199, 100, blue)
Draw.Line (200, 100, 340, 100, blue)
Draw.Line (339, 44, 339, 100, blue)
Draw.Line (200, 100, 340, 100, blue)
Draw.Line (44, 400, 44, 400, blue)
Draw.Line (390, 44, 340, 44, blue)
Draw.Line (390, 44, 390, 0, blue)

%Bouncing Ball
for i: 1..30
Draw.FillOval (100 +i,400 + i,9,9,blue)
delay(10)
Draw.FillOval (100 + i,400 + i,9,9,0)
end for

for i: 1..50
Draw.FillOval (150 +i,300 +i,9,9,blue)
delay(10)
Draw.FillOval (150 + i,300 + i,9,9,0)
end for

for i: 1..50
Draw.FillOval (350 +i,200 +i,9,9,blue)
delay(10)
Draw.FillOval (350 + i,200 + i,9,9,0)
end for
for decreasing i: 50..1
Draw.FillOval (550 +i,100 +i,9,9,blue)
delay(10)
Draw.FillOval (350 + i,100 + i,9,9,0)
end for


Mod Edit: Remember to use syntax tags!
code:
[syntax="turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
enimirahi




PostPosted: Fri Apr 17, 2009 9:04 pm   Post subject: RE:Animation help

HEY CAN someone plz try to help plz im dieing here plz
Alexmula




PostPosted: Fri Apr 17, 2009 9:46 pm   Post subject: RE:Animation help

hm.. is the animation supposed to be smooth? like do you have to use gravity and physics?
Dan




PostPosted: Fri Apr 17, 2009 9:56 pm   Post subject: RE:Animation help

It might help to draw it out on graph paper to scale with the dimentions first.

If the ball does not need to fallow real physics and is just an animation draw out the path on the paper you want it to follow. Think about where the ball should be to touch each stair and the path it needs to travel. Then if you drew the hole thing to scale you should be able to get a set of points then ball should travel threw and try to code it from that.

Note that the ball is bigger then a singal point so you need to take the radius in to account. It will strech out by the radius from the x,y point it is located at, so the ball's center should be 9 pixels (in this case) above the stair to make it just touch it.

For more info look at Draw.FillOval.

Also try to use loops to your full advantage and not just have a bunch of draw fill oval staments.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
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: