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

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




PostPosted: Sat Jan 19, 2013 9:55 pm   Post subject: help with animation

What is the problem you are having?
How do I make it so that the two moving lines collide and stay together in the centre?



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


for i: 1..160
    drawline (maxx div 2-300 + i, 150, maxx div 2-300 + i , 5, 16)
    drawline (maxx div 2+20 - i, 5, maxx div 2+20 - i, 150, 16)
    delay (10)
    drawline (maxx div 2-300 + i, 150, maxx div 2-300 + i , 5, white)
    drawline (maxx div 2+20 - i, 5, maxx div 2+20 - i, 150, white)
end for




Please specify what version of Turing you are using
using 4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Panphobia




PostPosted: Sat Jan 19, 2013 9:59 pm   Post subject: RE:help with animation

Look up some collision detection tutorials, and another hint, it might be useful to use a loop, rather than a for loop, and it might be useful to make your x co-ordinates variables
waffy




PostPosted: Sat Jan 19, 2013 10:31 pm   Post subject: Re: help with animation

erm...I've been reading some but I'm stupid so I still don't understand them.I just started learning Turing so any help would be nice.
DemonWasp




PostPosted: Sat Jan 19, 2013 11:46 pm   Post subject: RE:help with animation

By "collide" I'll assume you mean "appear to collide at a given point", rather than "I want to detect when two lines collide and simulate something based on that". The former is much easier.

You already have code that shows two lines approaching each other until they "collide". You also have code that draws over the lines old positions to prevent them from smearing.

All you need to do is add another set of draw commands after your end for to draw the "post collision" position.

@Panphobia: Please read the comment before replying. Collision-detection isn't necessary if he just wants the lines to stop when they appear to "hit" each other.
Panphobia




PostPosted: Sun Jan 20, 2013 1:54 am   Post subject: RE:help with animation

Yea I guess, but I wanted to make it variable, so the values can change and it would still do the same thing, because the way it would be done without collision would only work one way, and if you want to change it, you would need to change the for loop, to adjust for the number of pixels, etc
waffy




PostPosted: Sun Jan 20, 2013 10:24 pm   Post subject: RE:help with animation

could someone please write out the solution in code?
Tony




PostPosted: Mon Jan 21, 2013 1:29 am   Post subject: Re: RE:help with animation

waffy @ Sun Jan 20, 2013 10:24 pm wrote:
could someone please write out the solution in code?

You are exactly this someone!
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 7 Posts ]
Jump to:   


Style:  
Search: