help with animation
Author |
Message |
waffy
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Panphobia
![](http://compsci.ca/v3/uploads/user_avatars/62033050050c6b61548706.png)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
waffy
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Panphobia
![](http://compsci.ca/v3/uploads/user_avatars/62033050050c6b61548706.png)
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
waffy
|
Posted: Sun Jan 20, 2013 10:24 pm Post subject: RE:help with animation |
|
|
could someone please write out the solution in code? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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! |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|