Discuss Scratch

CartoonsMoviesGAMES
Scratcher
13 posts

Movement and gravity.

I need help with my coding, so when you jump, you don't jump and fall back down. you don't even move, and when I move the ground isn't solid.
sorry if my explaining is bad, here are the script:

when green flag clicked
if <key [right arrow key v] pressed?> then
switch costume to [running1 v]
wait (0.1) secs
next costume
end
if <key [left arrow key v] pressed?> then
switch costume to [running1 v]
wait (0.1) secs
next costume
end
if <key [space arrow key v] pressed?> then
switch costume to [jumping1 v]
wait (0.1) secs
next costume
wait (0.1) secs
next costume
end

when green flag clicked
if <key [right arrow key v] pressed?> then
change x by (10)
end
if <key [left arrow key v] pressed?> then
change x by (-10)
end
if <key [space key v] pressed?> then
if <touching [ground v] ?> then
repeat until <touching [ground v] ?>
change y by (10)
end
end
end
end

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
end
if <key [left arrow v] pressed?> then
point in direction (-90 v)
end
DragonFlyJr3000
Scratcher
35 posts

Movement and gravity.

You need to put forever blocks around all the code
when green flag clicked
forever
if <key [right arrow key v] pressed?> then
switch costume to [running1 v]
wait (0.1) secs
next costume
end
if <key [left arrow key v] pressed?> then
switch costume to [running1 v]
wait (0.1) secs
next costume
end
if <key [space arrow key v] pressed?> then
switch costume to [jumping1 v]
wait (0.1) secs
next costume
wait (0.1) secs
next costume
end

when green flag clicked
forever
if <key [right arrow key v] pressed?> then
change x by (10)
end
if <key [left arrow key v] pressed?> then
change x by (-10)
end
if <key [space key v] pressed?> then
if <touching [ground v] ?> then
repeat until <touching [ground v] ?>
change y by (10)
end
end
end
end

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
end
if <key [left arrow v] pressed?> then
point in direction (-90 v)
end
CartoonsMoviesGAMES
Scratcher
13 posts

Movement and gravity.

DragonFlyJr3000 wrote:

You need to put forever blocks around all the code
when green flag clicked
forever
if <key [right arrow key v] pressed?> then
switch costume to [running1 v]
wait (0.1) secs
next costume
end
if <key [left arrow key v] pressed?> then
switch costume to [running1 v]
wait (0.1) secs
next costume
end
if <key [space arrow key v] pressed?> then
switch costume to [jumping1 v]
wait (0.1) secs
next costume
wait (0.1) secs
next costume
end

when green flag clicked
forever
if <key [right arrow key v] pressed?> then
change x by (10)
end
if <key [left arrow key v] pressed?> then
change x by (-10)
end
if <key [space key v] pressed?> then
if <touching [ground v] ?> then
repeat until <touching [ground v] ?>
change y by (10)
end
end
end
end

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
end
if <key [left arrow v] pressed?> then
point in direction (-90 v)
end

I did, it just didn't put it in the message for some reason. it still doesnt work.

Powered by DjangoBB