Simultaneous moving images
Posted: Sat Dec 12, 2015 9:09 pm
answer "Hello World"
The dilemma: 3 images are moving simultaneously, a scrollbar that configures movespeed, a start/stop button.
My ideas:
start/stop: use lock moves and unlock moves, or interrupts the if loops I create to animate the images (see below)
Animation and speed: use an if loop to move images incrementally, using a Counter variable to control when it stops moving (I can't get the loop to stop). In these if loops, or in a loop by itself, activate a function that calls upon the scrollbar value and puts it into a variable that somehow scales the movement times of each image.
I have a water level that falls:
on moveWater
put [y distance water image needs to travel] into wCounter
if wCounter > 0
[move image water +1 in y direction]
subtract 1 from wCounter
send moveWater to me in 5*tScale milliseconds
else stop moving image water
end moveWater
For example, I have a droplet image that drips repeatedly, as long as the image of the water level is falling, and increase frequency with higher speed
on moveDrop
move image drop from [start] to [finish] in .5 milliseconds
send moveDrop to me in tscale*2 milliseconds
end moveDrop
and to disrupt the loop when water stops moving
on movestopped
stop moving image drop
end movestopped
Something like that. I want the scrollbar to go from 0 to 2 and rest at 1, and somewhere continuously update the time scale
put value of scrollbar speed into tScale
But I can't get this to work.
The dilemma: 3 images are moving simultaneously, a scrollbar that configures movespeed, a start/stop button.
My ideas:
start/stop: use lock moves and unlock moves, or interrupts the if loops I create to animate the images (see below)
Animation and speed: use an if loop to move images incrementally, using a Counter variable to control when it stops moving (I can't get the loop to stop). In these if loops, or in a loop by itself, activate a function that calls upon the scrollbar value and puts it into a variable that somehow scales the movement times of each image.
I have a water level that falls:
on moveWater
put [y distance water image needs to travel] into wCounter
if wCounter > 0
[move image water +1 in y direction]
subtract 1 from wCounter
send moveWater to me in 5*tScale milliseconds
else stop moving image water
end moveWater
For example, I have a droplet image that drips repeatedly, as long as the image of the water level is falling, and increase frequency with higher speed
on moveDrop
move image drop from [start] to [finish] in .5 milliseconds
send moveDrop to me in tscale*2 milliseconds
end moveDrop
and to disrupt the loop when water stops moving
on movestopped
stop moving image drop
end movestopped
Something like that. I want the scrollbar to go from 0 to 2 and rest at 1, and somewhere continuously update the time scale
put value of scrollbar speed into tScale
But I can't get this to work.