Animation
Author |
Message |
bvbjules13
![](http://compsci.ca/v3/uploads/user_avatars/66978344050ad764a63277.jpg)
|
Posted: Sat Dec 15, 2012 3:38 pm Post subject: Animation |
|
|
What is it you are trying to achieve?
run multiple animations at once
so basically i have an animation goign but i want to run another animation while this one is running so that hteir working at hte same time, is there a way i can do this? i cant seem to figure it out
Please specify what version of Turing you are using
4.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 Dec 15, 2012 3:48 pm Post subject: RE:Animation |
|
|
Post your code on here, we need to see the problem first ![Razz Razz](http://compsci.ca/v3/images/smiles/icon_razz.gif) |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Sat Dec 15, 2012 3:50 pm Post subject: RE:Animation |
|
|
Don't think of it as running multiple animations at the same time, but as one large animation. If that doesn't help, well, I'm trying to dig up a tutorial. I know we've got one somewhere. |
|
|
|
|
![](images/spacer.gif) |
bvbjules13
![](http://compsci.ca/v3/uploads/user_avatars/66978344050ad764a63277.jpg)
|
Posted: Sat Dec 15, 2012 3:51 pm Post subject: Re: Animation |
|
|
Turing: |
View.Set ("graphics: 1100, 600")
View.Set ("offscreenonly")
var xx : int
var yy : int
procedure Snow
xx := Rand.Int (1, 1100)
yy := 599
loop
yy := yy - 1
Draw.Fill (1, 1, 16, 44)
Draw.FillOval (xx, yy, 2, 2, 0)
delay (5)
View.Update
Draw.FillOval (xx, yy, 2, 2, 16)
end loop
end Snow
|
thats what i have atm, i need to run that a bunch of times; ik that to make snow you normally do it another way but i couldnt figure it out |
|
|
|
|
![](images/spacer.gif) |
Panphobia
![](http://compsci.ca/v3/uploads/user_avatars/62033050050c6b61548706.png)
|
Posted: Sat Dec 15, 2012 3:58 pm Post subject: RE:Animation |
|
|
i dont think you need a procedure, but this is what id do, make a loop with a random x than set yy to the same thing within that loop, then make another loop within that loop which exits when y = 0 |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Sat Dec 15, 2012 3:59 pm Post subject: RE:Animation |
|
|
code: | Draw.Fill (1, 1, 16, 44)
Draw.FillOval (xx, yy, 2, 2, 0)
delay (5)
View.Update
Draw.FillOval (xx, yy, 2, 2, 16) |
There's a problem with your draw order, for one thing.
You need at least one X and Y variable per thing that moves (hint: arrays are your friend). For example, here's how you move 2 things at once.
code: |
var ball1X : int := 10
var ball1Y : int := 10
var ball2X : int := 10
var ball2Y : int := 10
proc Animate
ball1X += 1 %move ball1 right
ball2Y += 1 %move ball2 up
Draw.FillOval (ball1X, ball1Y, 5, 5, blue)
Draw.FillOval (ball2X, ball2Y, 5, 5, red)
end Animate
loop
Animate
end loop |
This is 2 animations running at the same time. Or, it's 1 complicated animation.
To animate snow, you'll need hundreds of X and Y variables, but that's way too much code to write. Instead, use an array and a for loop. |
|
|
|
|
![](images/spacer.gif) |
Panphobia
![](http://compsci.ca/v3/uploads/user_avatars/62033050050c6b61548706.png)
|
Posted: Sat Dec 15, 2012 4:01 pm Post subject: RE:Animation |
|
|
ohh yea (facepalm) insectoid I did not account for hundreds of snow flakes ![Razz Razz](http://compsci.ca/v3/images/smiles/icon_razz.gif) |
|
|
|
|
![](images/spacer.gif) |
bvbjules13
![](http://compsci.ca/v3/uploads/user_avatars/66978344050ad764a63277.jpg)
|
Posted: Sat Dec 15, 2012 4:04 pm Post subject: Re: Animation |
|
|
oh ok thxs! that makes a lot more sense now; thank you! |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|