Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Horizontal Acceleration
- thescratchbros
- Scratcher
13 posts
Horizontal Acceleration
I can't create a decent accelleration script. So, help?
- PH-zero
- Scratcher
100+ posts
Horizontal Acceleration
Make a vareable, call it velocity.
Then put togehter a script like this:
When greenflag clicked
|Set |Velocity| to (0) |
forever
if < <Button arrow up pressed> and <Velocity < (3.5)> >
|Change |Velocity| by (0.1) |
else
if <Velocity > (0)>
| change |Velocity| by (-0.1) |
end if
end if
|change y by (Velocity) |
end forever
Then put togehter a script like this:
When greenflag clicked
|Set |Velocity| to (0) |
forever
if < <Button arrow up pressed> and <Velocity < (3.5)> >
|Change |Velocity| by (0.1) |
else
if <Velocity > (0)>
| change |Velocity| by (-0.1) |
end if
end if
|change y by (Velocity) |
end forever
- turkey3
- Scratcher
1000+ posts
Horizontal Acceleration
That's vertical acceleration. I made a script Make a vareable, call it velocity.here for horizontal.
Then put togehter a script like this:
When greenflag clicked
|Set |Velocity| to (0) |
forever
if < <Button arrow up pressed> and <Velocity < (3.5)> >
|Change |Velocity| by (0.1) |
else
if <Velocity > (0)>
| change |Velocity| by (-0.1) |
end if
end if
|change y by (Velocity) |
end forever
- DotDash
- Scratcher
1000+ posts
Horizontal Acceleration
You just copied that script from The wiki page.That's vertical acceleration. I made a script Make a vareable, call it velocity.here for horizontal.
Then put togehter a script like this:
When greenflag clicked
|Set |Velocity| to (0) |
forever
if < <Button arrow up pressed> and <Velocity < (3.5)> >
|Change |Velocity| by (0.1) |
else
if <Velocity > (0)>
| change |Velocity| by (-0.1) |
end if
end if
|change y by (Velocity) |
end forever
My browser / operating system: MacOS Macintosh X 10.8.5, Chrome 29.0.1547.76, Flash 11.8 (release 800)
- turkey3
- Scratcher
1000+ posts
Horizontal Acceleration
No, I actually didn't, honestly, but I now see that it's almost exactly identicalYou just copied that script from The wiki page.That's vertical acceleration. I made a script Make a vareable, call it velocity.here for horizontal.
Then put togehter a script like this:
When greenflag clicked
|Set |Velocity| to (0) |
forever
if < <Button arrow up pressed> and <Velocity < (3.5)> >
|Change |Velocity| by (0.1) |
else
if <Velocity > (0)>
| change |Velocity| by (-0.1) |
end if
end if
|change y by (Velocity) |
end forever
- ProdigyZeta7
- Scratcher
1000+ posts
Horizontal Acceleration
If you're looking for an easy two-way acceleration script, use this:
Hope this works for you!
when gf clicked
set [speed v] to (0)
forever
if <key [right arrow v] pressed?>
change [speed v] by (1)
endif
if <key [left arrow v] pressed?>
change [speed v] by (-1)
endif
change x by (speed)
set [speed v] to ((speed) * (0.9))
endforever
Last edited by ProdigyZeta7 (July 30, 2013 00:32:48)
- DotDash
- Scratcher
1000+ posts
Horizontal Acceleration
That's almost exactly like turkey3's If you're looking for an easy two-way acceleration script, use this:You're welcome!when gf clicked
set [speed v] to (0)
forever
if <key [right arrow v] pressed?>
change [speed v] by (1)
endif
if <key [left arrow v] pressed?>
change [speed v] by (-1)
endif
change x by (speed)
set [speed v] to ((speed) * (0.9)
endforever
My browser / operating system: MacOS Macintosh X 10.8.5, Chrome 29.0.1547.76, Flash 11.8 (release 800)
- ProdigyZeta7
- Scratcher
1000+ posts
Horizontal Acceleration
Nevermind. Didn't look.That's almost exactly like turkey3's If you're looking for an easy two-way acceleration script, use this:You're welcome!when gf clicked
set [speed v] to (0)
forever
if <key [right arrow v] pressed?>
change [speed v] by (1)
endif
if <key [left arrow v] pressed?>
change [speed v] by (-1)
endif
change x by (speed)
set [speed v] to ((speed) * (0.9))
endforever
Last edited by ProdigyZeta7 (July 30, 2013 00:36:28)
- Discussion Forums
- » Help with Scripts
- » Horizontal Acceleration