Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make the Sonic Speed Mechanic
- DordusRising
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
I want to make it where Sonic increases speed when the arrow keys/directional buttons for mobile are pressed to make him go forward. Can someone give me a script for it? Thanks in advance.
- jdmdigital
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
Do you have a speed variable?
Im not familiar with the mobile arrow keys. Id made a sprite for arrow buttons then code them to work off a speed varible. Are you familiar that?
Im not familiar with the mobile arrow keys. Id made a sprite for arrow buttons then code them to work off a speed varible. Are you familiar that?
- shantipepsi
-
Scratcher
20 posts
How to make the Sonic Speed Mechanic
I want to make it where Sonic increases speed when the arrow keys/directional buttons for mobile are pressed to make him go forward. Can someone give me a script for it? Thanks in advance.
hello, I think I have a solution to your speed problem:
forever
if <key [ right v] pressed?> then
change [speed x v] by (1,45)
set x to (speed x)
end
endwhen green flag clicked
- The_Imaginarium
-
Scratcher
1000+ posts
How to make the Sonic Speed Mechanic
You can simulate acceleration like so:
define move (speed) (friction)
if <key [right v] pressed?> then
change [P_X SPEED v] by (speed) // I recommend 2 or 3 in this input
end
if <key [left v] pressed?> then
change [P_X SPEED v] by ((speed)*(-1)) // see above
end
set [P_X SPEED v] to ((P_X SPEED)*(friction)) // I recommend 0.8 in this input
change x by (P_X SPEED)
- DordusRising
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
Do you have a speed variable?I know how to code mobile controls (I just set whatever direction it is to true when the sprite is touching the pointer), but I just need the speed mechanic from the classic Sonic games. As to how they work off of a speed variable themselves, I don’t know ho that would work. Can you show me?
Im not familiar with the mobile arrow keys. Id made a sprite for arrow buttons then code them to work off a speed varible. Are you familiar that?
- DordusRising
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
You can simulate acceleration like so:Thank you! I’ll try that.define move (speed) (friction)
if <key [right v] pressed?> then
change [P_X SPEED v] by (speed) // I recommend 2 or 3 in this input
end
if <key [left v] pressed?> then
change [P_X SPEED v] by ((speed)*(-1)) // see above
end
set [P_X SPEED v] to ((P_X SPEED)*(friction)) // I recommend 0.8 in this input
change x by (P_X SPEED)
- jdmdigital
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
DordusRising,
I see your reply and I see The_Imaginarium has provided a solution. HOpe it works out for you. I'll monitor in case other issues pop up. I look forward to your getting this one done so I can learn the mobile stufff from it.
I see your reply and I see The_Imaginarium has provided a solution. HOpe it works out for you. I'll monitor in case other issues pop up. I look forward to your getting this one done so I can learn the mobile stufff from it.
- DordusRising
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
DordusRising,You can learn mobile controls with my tutorial (I will provide a link soon)
I see your reply and I see The_Imaginarium has provided a solution. HOpe it works out for you. I'll monitor in case other issues pop up. I look forward to your getting this one done so I can learn the mobile stufff from it.
- DordusRising
-
Scratcher
100+ posts
How to make the Sonic Speed Mechanic
Link to tutorial: https://scratch.mit.edu/projects/490266224
- Discussion Forums
- » Help with Scripts
-
» How to make the Sonic Speed Mechanic



