I found some jumping scripts from various forums and scratch projects but each one of them always makes my sprite go through the platform instead of going on top of it like it does in the examples. If anyone could help me that would be great
I used two basic types of coding since I couldn't understand most of the advanced variable jumping scripts:
1:
<when[ up ]key pressed>
<forever if><key[ up arrow ]pressed?>
<set{ Gravity }to( 12)
<change y by( 10)
<repeat until><touching[ Platform ]
<change{ Gravity }by( -1)
<change y by( Gravity)
2:
<when green flag clicked>
<set{ Jump }to( 0 )
<forever>
<if><< <( Jump <=> 0 )><and> << <not> <touching[ Platform >> >>
<repeat( 10
<change y by( -10
<wait( 0.03 )secsc>
<when[ up arrow ]key pressed>
<set{ Jump }to( 1
<if><touching[ Platform
<repeat( 10
<change y by( 10
<wait( 0.03 )secsc>
<repeat( 10
<if><< <not> <touching[ Platform >>
<change y by( -10
<wait( 0.03 )secsc>
<set{ Jump }to( 0
Offline
Thanks I'll try it out and hopefully it will work
Offline
Try StrykerV's velocity suggestion. or...
{when GF clicked}
forever
if <key up arrow pressed>
repeat 10
change Y by 10
end
else
if <touching ground>
change Y by 10
end
if <not<touching ground>>
change Y by -10
end
Offline
hello12345678910 wrote:
Try StrykerV's velocity suggestion. or...
{when GF clicked}
forever
if <key up arrow pressed>
repeat 10
change Y by 10
end
else
if <touching ground>
change Y by 10
end
if <not<touching ground>>
change Y by -10
end
I tried doing this script but it makes the sprite jittery but thanks for the script
Offline
SnowBall94 wrote:
hello12345678910 wrote:
Try StrykerV's velocity suggestion. or...
{when GF clicked}
forever
if <key up arrow pressed>
repeat 10
change Y by 10
end
else
if <touching ground>
change Y by 10
end
if <not<touching ground>>
change Y by -10
endI tried doing this script but it makes the sprite jittery but thanks for the script
![]()
he will not jitter in presentation mode or on the site, just in the editor
Offline
hello12345678910 wrote:
SnowBall94 wrote:
hello12345678910 wrote:
Try StrykerV's velocity suggestion. or...
{when GF clicked}
forever
if <key up arrow pressed>
repeat 10
change Y by 10
end
else
if <touching ground>
change Y by 10
end
if <not<touching ground>>
change Y by -10
endI tried doing this script but it makes the sprite jittery but thanks for the script
![]()
he will not jitter in presentation mode or on the site, just in the editor
It worked thanks but is there another coding that I could put in so even if you continously press the up button he doesn't go any higher than I want him too?
Offline
SnowBall94 wrote:
hello12345678910 wrote:
SnowBall94 wrote:
I tried doing this script but it makes the sprite jittery but thanks for the script
![]()
he will not jitter in presentation mode or on the site, just in the editor
It worked thanks
but is there another coding that I could put in so even if you continously press the up button he doesn't go any higher than I want him too?
For some reason now its jittery in both editor and presentation ....i didn't change any of the codings
Offline
StrykerV wrote:
Have you tried using velocity?
If not, try this
When I tried yours, it worked better than my old one, but it sometimes get stuck if there are multiple ground on top of one another like this
------------
--------------------------
----------------------------------------------------
any way to fix this?
Offline
SnowBall94 wrote:
StrykerV wrote:
Have you tried using velocity?
If not, try thisWhen I tried yours, it worked better than my old one, but it sometimes get stuck if there are multiple ground on top of one another like this
------------
--------------------------
----------------------------------------------------
any way to fix this?
The velocity tutorial I made that StrykerV linked you to only covers basic jumping. You'd have to try more advanced things such as collision testing if you want to prevent the sprite from getting stuck.
Here is a relatively simple project with collision testing you might want to look at: http://scratch.mit.edu/projects/archmage/101212
If you have questions about the script in that project, just ask us here
Offline
demosthenes wrote:
SnowBall94 wrote:
StrykerV wrote:
Have you tried using velocity?
If not, try thisWhen I tried yours, it worked better than my old one, but it sometimes get stuck if there are multiple ground on top of one another like this
------------
--------------------------
----------------------------------------------------
any way to fix this?The velocity tutorial I made that StrykerV linked you to only covers basic jumping. You'd have to try more advanced things such as collision testing if you want to prevent the sprite from getting stuck.
Here is a relatively simple project with collision testing you might want to look at: http://scratch.mit.edu/projects/archmage/101212
If you have questions about the script in that project, just ask us here![]()
Thanks for the link but I think that script may be too advanced for me.
Offline