This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-09-28 17:00:41

Mattjod
Scratcher
Registered: 2012-09-17
Posts: 20

what is a simple jumping script????????

...


smile  -Mattjod   roll

Offline

 

#2 2012-09-28 17:03:19

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: what is a simple jumping script????????

when [up v] key pressed
go up [some]
wait[a bit]
go down [some]
by the scripts workshop

Last edited by dvd4 (2012-09-28 18:59:00)


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#3 2012-09-28 17:42:30

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: what is a simple jumping script????????

"Jumping" is very vague.  The complexity of the script will depend on what exactly you want it to do.  The Scratch wiki should be able to help:
http://wiki.scratch.mit.edu/wiki/Jumping


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-09-28 18:18:56

gfchll
Scratcher
Registered: 2012-04-21
Posts: 100+

Re: what is a simple jumping script????????

 when [up arrow v] key pressed
repeat (10)
change y by (10)
end 
wait (1)secs//or any amt. of secs
repeat (10)
change y by (-10)
end
if you want to add velocity, put it afer the change y by block.(in the repeat still.

Last edited by gfchll (2012-09-28 18:20:05)


HELLO EVERYBODY!

Offline

 

#5 2012-09-28 19:32:47

maxamillion321
Scratcher
Registered: 2011-06-17
Posts: 500+

Re: what is a simple jumping script????????

gfchll wrote:

 when [up arrow v] key pressed
repeat (10)
change y by (10)
end 
repeat (10)
change y by (-10)
end
if you want to add velocity, put it afer the change y by block.(in the repeat still.

Fixed

Offline

 

#6 2012-12-12 22:29:03

jaxoncava
New Scratcher
Registered: 2012-12-03
Posts: 1

Re: what is a simple jumping script????????

when space pressed
change y by 50
wait 0.5 seconds
change y by -50

this is a simple jumping script

Offline

 

#7 2012-12-13 20:23:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: what is a simple jumping script????????

jaxoncava wrote:

when [space v] key pressed
change y by (50)
wait (0.5) secs
change y by (-50)
this is a simple jumping script

Fixed.

Last edited by ErnieParke (2012-12-13 20:23:52)


http://i46.tinypic.com/35ismmc.png

Offline

 

#8 2012-12-13 20:37:04

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: what is a simple jumping script????????

ErnieParke wrote:

jaxoncava wrote:

when [space v] key pressed
change y by (50)
wait (0.5) secs
change y by (-50)
this is a simple jumping script

Fixed.

No, you changed the script.
Because of the delay scratch has, doing this

when [space v] key pressed
change y by (50)
wait (0.5) secs
change y by (-50)
will have the sprite suddenly go up 50 pixels, then suddenly go down 50 pixels. But, if you do this
when [space v] key pressed
repeat (10)
change y by (5)
end
wait (0) secs //change
repeat (10)
change y by (-5)
end
because of scratch's built in wait time, it will actually show it (sort-of) glide up 50 pixels, then glide down 50 pixels. Instead of just appearing higher, then going back.

Last edited by TorbyFork234 (2012-12-13 20:37:19)

Offline

 

#9 2012-12-13 20:56:05

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: what is a simple jumping script????????

TorbyFork234 wrote:

ErnieParke wrote:

jaxoncava wrote:

when [space v] key pressed
change y by (50)
wait (0.5) secs
change y by (-50)
this is a simple jumping script

Fixed.

No, you changed the script.

When I had said "fixed", I had meant that I had fixed the scratchblocks code itself so that the scratch blocks were displayed correctly; nothing more. I hope that this clears things up.


http://i46.tinypic.com/35ismmc.png

Offline

 

#10 2012-12-19 21:46:23

maxamillion321
Scratcher
Registered: 2011-06-17
Posts: 500+

Re: what is a simple jumping script????????

when gf clicked
repeat (10)
change y by (10)
end
repeat (10)
change y by (-10)
Go ahead and try this because I know it works.

Last edited by maxamillion321 (2012-12-19 21:46:32)

Offline

 

#11 2012-12-20 03:38:51

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: what is a simple jumping script????????

IMO the best way to jump is to use a little bit of magic (trig).

set [base_y v] to (y position)
set [jpos v] to [0]
repeat (45)
 change [jpos v] by (4)
 set y to ((base_y) + (([sin v] of (jpos)) * (jump height)))
end

Offline

 

#12 2012-12-20 05:14:56

fillergames
Scratcher
Registered: 2012-10-15
Posts: 1000+

Re: what is a simple jumping script????????

maxamillion321 wrote:

when gf clicked
repeat (10)
change y by (5)
end
repeat untill (touching ground v)
change y by (-5)
end
Go ahead and try this because I know it works.

Fixed. Made it so the character falls no matter how high or low the ground is.

Edit can anybody tell me how to make the repeat untill wrap around the change Y block?

Last edited by fillergames (2012-12-20 05:17:38)


http://i50.tinypic.com/2ufvxc5_th.gif Grammer? Whats grammar?

Offline

 

#13 2012-12-20 05:17:34

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: what is a simple jumping script????????

fillergames wrote:

maxamillion321 wrote:

when gf clicked
repeat (10)
change y by (5)
end
repeat untill (touching ground v)
change y by (-5)
end
Go ahead and try this because I know it works.

Fixed. Made it so the character falls no matter how high or low the ground is.

I just realized that that is also wrong with my script  tongue

Offline

 

#14 2012-12-20 05:25:30

fillergames
Scratcher
Registered: 2012-10-15
Posts: 1000+

Re: what is a simple jumping script????????

Gravitation wrote:

fillergames wrote:

maxamillion321 wrote:

when gf clicked
repeat (10)
change y by (5)
end
repeat untill (touching ground v)
change y by (-5)
end
Go ahead and try this because I know it works.

Fixed. Made it so the character falls no matter how high or low the ground is.

I just realized that that is also wrong with my script  tongue

I can't get the repeat untill block to wrap around the change Y block. Its annoying.


http://i50.tinypic.com/2ufvxc5_th.gif Grammer? Whats grammar?

Offline

 

#15 2012-12-20 13:25:50

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: what is a simple jumping script????????

fillergames wrote:

Gravitation wrote:

fillergames wrote:

Fixed. Made it so the character falls no matter how high or low the ground is.

I just realized that that is also wrong with my script  tongue

I can't get the repeat untill block to wrap around the change Y block. Its annoying.

Fixed  smile

when gf clicked
repeat (10)
change y by (5)
end
repeat until<touching [ground v]?>
change y by (-5)
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#16 2012-12-20 15:14:52

CanadianGeorge
Scratcher
Registered: 2012-11-21
Posts: 100+

Re: what is a simple jumping script????????

fillergames wrote:

maxamillion321 wrote:

when gf clicked
repeat (10)
change y by (5)
end
repeat untill (touching ground v)
change y by (-5)
end
Go ahead and try this because I know it works.

Fixed. Made it so the character falls no matter how high or low the ground is.

Edit can anybody tell me how to make the repeat untill wrap around the change Y block?

For one thing, you're spelling until wrong.  This should work:

repeat until <touching [ground v]?>
change y by (-5)
end


smile   neutral   sad   big_smile   yikes   wink   hmm   tongue   lol   mad   roll   cool
"You're weird" -My Sister

Offline

 

#17 2012-12-20 15:27:24

fillergames
Scratcher
Registered: 2012-10-15
Posts: 1000+

Re: what is a simple jumping script????????

CanadianGeorge wrote:

fillergames wrote:

maxamillion321 wrote:

when gf clicked
repeat (10)
change y by (5)
end
repeat until <touching? [ground v]>
change y by (-5)
end
Go ahead and try this because I know it works.

Fixed. Made it so the character falls no matter how high or low the ground is.

Edit can anybody tell me how to make the repeat untill wrap around the change Y block?

For one thing, you're spelling until wrong.  This should work:

repeat until <touching [ground v]?>
change y by (-5)
end

Thanks for the help!

Last edited by cheddargirl (2012-12-21 01:59:41)


http://i50.tinypic.com/2ufvxc5_th.gif Grammer? Whats grammar?

Offline

 

Board footer