Discuss Scratch

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

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
turkey3
Scratcher
1000+ posts

Horizontal Acceleration

PH-zero wrote:

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
That's vertical acceleration. I made a script here for horizontal.

DotDash
Scratcher
1000+ posts

Horizontal Acceleration

turkey3 wrote:

PH-zero wrote:

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
That's vertical acceleration. I made a script here for horizontal.
You just copied that script from The wiki page.

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

DotDash wrote:

turkey3 wrote:

PH-zero wrote:

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
That's vertical acceleration. I made a script here for horizontal.
You just copied that script from The wiki page.
No, I actually didn't, honestly, but I now see that it's almost exactly identical

ProdigyZeta7
Scratcher
1000+ posts

Horizontal Acceleration

If you're looking for an easy two-way acceleration script, use this:
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
Hope this works for you!

Last edited by ProdigyZeta7 (July 30, 2013 00:32:48)




DotDash
Scratcher
1000+ posts

Horizontal Acceleration

ProdigyZeta7 wrote:

If you're looking for an easy two-way acceleration script, use this:
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
You're welcome!
That's almost exactly like turkey3's

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

DotDash wrote:

ProdigyZeta7 wrote:

If you're looking for an easy two-way acceleration script, use this:
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
You're welcome!
That's almost exactly like turkey3's
Nevermind. Didn't look.

Last edited by ProdigyZeta7 (July 30, 2013 00:36:28)




Powered by DjangoBB