Hey there.....I am a newbie and am developing a fighting game on scratch. The trouble is, my character doesn't jump. Can anybody help me out please?????
Please suggest the simplest way to execute this command.
The guy with the best answer gets his name in my game's credits!
Quick!!!!Help me!!!!!
Thanks a lot!
Offline
It depends on what you want it to take into account. For instance, LFOB's script doesn't use gravity or let you jump to a ground of different elevation. Do you want a script that includes those? Do you want a script that detects ceilings? Please be more specific.
Offline
RedRocker227 wrote:
Try looking at this. It even says how to bounce as well.
Hey RedRocker227, thanks a billion for the tutorial, but still all it does is go up and stay there, though I copied your steps exactly. I would really like you to program the jumps. Can you please write a script for making the fighters jump on this post, using the blocks just like LFOB did? The game is multiplayer and one fighter jumps with W while the other jumps with up arrow key. Please help me out pal.
Hey LFOB, your script works but the jumps don't look real. Can you write the script again so that the sprite goes up and comes down without stopping in the air for a second? Thanks!
Offline
try using this:
<when green flag clicked>
<forever>
<if><key[ up arrow ]pressed?>
<set{ yvelocity }to( 5)
<change y by( 5)
<repeat until><touching color[ color of platforms ]
<change y by( <{ yvelocity }>
<change{ yvelocity }by( -.2)
<set{ yvelocity }to( 0)
<repeat until><< <not> >><touching color[ color of platforms ]
<change y by( 3 )
<if><touching color[ color of platforms ]
<change y by( 0)
<else>
<change y by( -3)
Offline
mayukhnair wrote:
RedRocker227 wrote:
Try looking at this. It even says how to bounce as well.
Hey RedRocker227, thanks a billion for the tutorial, but still all it does is go up and stay there, though I copied your steps exactly. I would really like you to program the jumps. Can you please write a script for making the fighters jump on this post, using the blocks just like LFOB did? The game is multiplayer and one fighter jumps with W while the other jumps with up arrow key. Please help me out pal.
So you're saying it goes up, but doesn't come back down? Have you made sure you've got the bit like this: 'change 'y velocity' by -1' in the 'else' bit of the 'if touching colour [colour of ground]' ?
Offline
[blocks]
<when[ space ]key pressed>
<glide(1 )secs to x <x position> )y (( <y position> <+> 30 )))
<glide(1 )secs to x <x position> )y (( <y position> <-> 30 )))
[/blocks]
Last edited by raffalevy (2011-11-27 11:00:01)
Offline
Well, first you need to change the Y. So, I would recommend that you change the Y by probably 30-60. Then, you need to wait 1 or 0.5 seconds, basically how long you want it to be. Then, change Y by -30, or the number you use to change the Y the first time.
[blocks]<when[space key pressed> ] OR <when[ up arrow ]key pressed><change y by(#, preferably 30-60)<wait( 1 )secsc><change y by( -#, what you used to change the first y) [/blocks]
Have fun with that game!
Last edited by codes321 (2011-11-27 11:06:25)
Offline
Sorry the image link I posted earlier doesn't work - just add this into a html viewer (http://www.tizag.com/htmlPractice.php)
<a href="http://s1096.photobucket.com/albums/g332/rhea_lity/?action=view&current=script.png" target="_blank"><img src="http://i1096.photobucket.com/albums/g332/rhea_lity/script.png" border="0" alt="Photobucket"></a>
it shows how to make your character jump and move side to side?
Offline
itchyback wrote:
http://tinypic.com/r/10of94x/5
Fixed!
Just put this:
[url=http://www.example.com]Text goes here[/url]
And also, the 'Change x velocity by 2' is WAY too high. It needs to be something like 0.3.
Last edited by RedRocker227 (2011-12-02 10:38:34)
Offline
jumping can be accomplished by using a variable. some scratchers call it "gravity", but I normally call it "y velocity" unless there is a more advanced script in which this is already a variable. I normally use this script:
when green flag clicked
|set [y velocity] to [0]|
|forever|
|chance y by (y velocity)|
|change [y velocity] by [-1]|
|if <touching colour [{floor colour}]>|
|set [y velocity] to [0]|
|if <key [{jump button}] pressed?>|
|set [y velocity] to [{how high you want to jump}]|
for this to fully work, the second "if" block should be inside the first.
Offline
sorry, my finger slipped when I wrote "change" one time, and I only noticed this after submitting the post. sorry if this confused you.
Offline
vectrex wrote:
i was wondering, how do you hake a charecter jump AND move at the same time?
Ugh, necroposters...
Offline