Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with Spindash
- HashtagBenches
-
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
-
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
-
28 posts
Help with Spindash
Something went wrong above.when green flag clicked
forever
set [x moving v] to [((x moving) * (0.9)) ]
change x by (x moving)
end
when green flag clickedBy the way, there is no limit on its speed. If you want to set maximum speed, you should set a limitation.
forever
set [x moving v] to ((x moving) * (0.9))
change x by (x moving)
end
when green flag clicked
forever
if <(x moving) > [5]> then
set [x moving v] to [5]
end
end
- FrankieJrJr
-
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
-
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
-
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
-
8 posts
Help with Spindash
or maybe
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) stepsmight not sure try this
- virockstr
-
8 posts
Help with Spindash
or maybewhen 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
andwhen I receive [ spin]
change x by (speed spin dash)
Last edited by virockstr (July 14, 2021 15:36:51)
- wifighostGD
-
3 posts
Help with Spindash
None of these work for me. can you guys try and make some different scripts.
- bean6445
-
49 posts
Help with Spindash
I already scrapped the idea of giving Japan the ability to do that move.
- wifighostGD
-
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
-
1 post
Help with Spindash
Yeah one of the scrips work just my variable is at 370 which makes it go really fast
- sonic_x10
-
1 post
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
endwhen 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)
- Discussion Forums
- » Help with Scripts
-
» Help with Spindash