Discuss Scratch

HashtagBenches
Scratcher
4 posts

Help with Spindash

So I'm trying to make Sonic's spindash. The way I want it to work is: the longer you hold the button (down arrow) the further he'll go. I need help with making him do that. From what I understand, it should be: detecting whether the key is held down, while it's held down add numbers to a variable(s) (Spindash) until the key is let go, then release him, moving however many steps, and then clearing the variable(s).
chantszfung99
Scratcher
28 posts

Help with Spindash

You can do it like this:
when green flag clicked
forever

if <key [right arrow v] pressed?> then

change [x moving v] by (0.2)
end
if <key [left arrow v] pressed?> then

change [x moving v] by (-0.2)
end

end

when green flag clicked
forever
set [x moving v] to [((x moving) * (0.9)) ]
change x by (x moving)
end
chantszfung99
Scratcher
28 posts

Help with Spindash

chantszfung99 wrote:

when green flag clicked
forever
set [x moving v] to [((x moving) * (0.9)) ]
change x by (x moving)
end
Something went wrong above.
when green flag clicked
forever
set [x moving v] to ((x moving) * (0.9))
change x by (x moving)
end
By the way, there is no limit on its speed. If you want to set maximum speed, you should set a limitation.
when green flag clicked
forever

if <(x moving) > [5]> then

set [x moving v] to [5]
end

end
FrankieJrJr
Scratcher
100+ posts

Help with Spindash

when green flag clicked
forever
if <key [space] pressed?> then
point in direction (pick random (-180) to (180))
end

end
HashtagBenches
Scratcher
4 posts

Help with Spindash

Thanks! Not entirely what I was looking for, but I think I could tweak it a little to work how I intended.
2rayansonic3
Scratcher
3 posts

Help with Spindash

when green flag clicked
forever
if <<<key [ x] pressed?>> and <<key [down arrow] pressed?>> then
wait until <not <<key [x] pressed?> and <<key [ down arrow] pressed?>>>
move (4) steps

might not sure try this not varibles

Last edited by 2rayansonic3 (March 4, 2021 14:28:00)

virockstr
Scratcher
8 posts

Help with Spindash

or maybe

2rayansonic3 wrote:

when green flag clicked
forever
if <<<key [ x] pressed?>> and <<key [down arrow] pressed?>> then
wait until <not <<key [x] pressed?> and <<key [ down arrow] pressed?>>>
move (speed spin dash) steps
might not sure try this 
virockstr
Scratcher
8 posts

Help with Spindash

virockstr wrote:

or maybe

2rayansonic3 wrote:

when green flag clicked
forever
if<<<key [ x] pressed?>> and <<key [down arrow] pressed?>>
then
repeat until <<<not<<<key [ x] pressed?>> and <<key [down arrow] pressed?>>
>change [ speed spin dash] by (1)
>

switch costume to [ spin]

broadcast [ spin]
might not sure try this 


and

when I receive [ spin]
change x by (speed spin dash)

Last edited by virockstr (July 14, 2021 15:36:51)

wifighostGD
Scratcher
3 posts

Help with Spindash

None of these work for me. can you guys try and make some different scripts.
bean6445
Scratcher
49 posts

Help with Spindash

I already scrapped the idea of giving Japan the ability to do that move.
wifighostGD
Scratcher
3 posts

Help with Spindash

im not saying they don't work its just that i have arrow key movements and the spindash isn't staying still so it still works its just that the spindash moves when i press arrow keys. let me give you a link to my game https://scratch.mit.edu/projects/962105532/

Last edited by wifighostGD (Feb. 16, 2024 15:17:55)

ActingMan
Scratcher
1 post

Help with Spindash

Yeah one of the scrips work just my variable is at 370 which makes it go really fast
TysontheWolf
Scratcher
2 posts

Help with Spindash

TELL ME HOW YOU DID IT PLEASE
sonic_x10
Scratcher
1 post

Help with Spindash

chantszfung99 wrote:

You can do it like this:
when green flag clicked
forever

if <key [right arrow v] pressed?> then

change [x moving v] by (0.2)
end
if <key [left arrow v] pressed?> then

change [x moving v] by (-0.2)
end

end

when green flag clicked
forever
set [x moving v] to [((x moving) * (0.9)) ]
change x by (x moving)
end

Last edited by sonic_x10 (May 1, 2025 20:37:53)

Powered by DjangoBB