This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-12-28 17:20:48

km9000
New Scratcher
Registered: 2012-11-23
Posts: 1

Canceling an animation script by key press/release

I have two basic similar situations with a common problem.

One involves an introductory title screen animation. Instead of always waiting for it to finish, I want the option to press a key to skip to the menu screen. What I've tried so far, either it doesn't respond at all, or it will go the menu but continue with the intro script.

Second is simply stopping a walking animation when the move left/right keys are released. Right now it will finish the cycle before going idle.

Thanks in advance.

Offline

 

#2 2012-12-28 17:25:14

fetchydog567
Scratcher
Registered: 2011-12-28
Posts: 500+

Re: Canceling an animation script by key press/release

What is the script?


http://www.minecraftanonymous.com/assets/banners/banner_51.pngJust a reminder I won't be on Scratch that much but I 'll still be here, so if i'm on something, I will be commenting back, okay! wink , PICO Team!!!!!!!!!!! SCRATCH DEADW!!! PICO HACK ACCOUTNTT@@

Offline

 

#3 2012-12-28 17:28:54

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Canceling an animation script by key press/release

With the first one, I probably need the script, but I think you might be doing something like:
[scratchblocks]
when gf clicked
repeat until <trigger key pressed>


http://i49.tinypic.com/rk60py.png

Offline

 

#4 2012-12-28 17:32:38

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Canceling an animation script by key press/release

With the first one, I probably need the script, but I think you might be doing something like:

when gf clicked
repeat until <[trigger key v] pressed>
    animation script here
end
What you would need would be:
when gf clicked
repeat until <[trigger key v] pressed>
    if <not <(end_animation) = [1]>>
        animation script part one here
        repeat the above script until the animation restarts
    else
        stop script
end
You would also need, on any sprite:
when gf clicked
if <[trigger key v] pressed>
    set <end_animation> to 1
end

Last edited by Programmer_112 (2012-12-28 17:46:40)


http://i49.tinypic.com/rk60py.png

Offline

 

#5 2012-12-28 17:43:29

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Canceling an animation script by key press/release

With the second, you probably need to split it into parts, and put in:

when gf clicked
forever
    if <<key [right arrow v] pressed> or <key [left arrow v] pressed>>
        repeat until <<i = [number of steps in sequence]> or <not<<key [right arrow v] pressed> or <key [left arrow v] pressed>>>>
            change [i v] by one
            do i part of sequence
        end
    end
end

Last edited by Programmer_112 (2012-12-28 17:45:36)


http://i49.tinypic.com/rk60py.png

Offline

 

Board footer