Discuss Scratch

SalazarRiddle
New Scratcher
2 posts

Problem with move

Hello,

I just start my journey with Scratch. Nice to meet you all.

I have problem with movement. Up arrow works correctly. Unfortunatelly down,left and right arrow didn't work. I read the guide on how to move and did everything according to the instructions. Unfortunately, only the up arrow works. Asking for help and clarification.

My project:

https://scratch.mit.edu/projects/850749202/
legendary34678
Scratcher
1000+ posts

Problem with move

As your code is written right now, the other if loops will only activate if the up arrow is held down. You need to take the if loops out of the other up arrow if loop like so:

NOT THIS:
forever
if <> then
if <> then
if <> then
if <> then

end
end
end
end
end

LIKE THIS:
forever
if <> then

end
if <> then

end
if <> then

end
if <> then

end
end
FoxesAreTheCutest12
Scratcher
37 posts

Problem with move

SalazarRiddle wrote:

Hello,

I just start my journey with Scratch. Nice to meet you all.

I have problem with movement. Up arrow works correctly. Unfortunatelly down,left and right arrow didn't work. I read the guide on how to move and did everything according to the instructions. Unfortunately, only the up arrow works. Asking for help and clarification.

My project:

https://scratch.mit.edu/projects/850749202/

I can help!
Instead of putting the if blocks in each other, you put it like this:
when green flag clicked
forever
if <key [up arrow v] pressed?> then
point in direction (0)
move (2) steps
end
if <key [down arrow v] pressed?> then
point in direction (180)
move (2) steps
end
if <key [right arrow v] pressed?> then
point in direction (90)
move (2) steps
end
if <key [left arrow v] pressed?> then
point in direction (-90)
move (2) steps
end
end
coIIide
Scratcher
100+ posts

Problem with move

SalazarRiddle wrote:

Hello,

I just start my journey with Scratch. Nice to meet you all.

I have problem with movement. Up arrow works correctly. Unfortunatelly down,left and right arrow didn't work. I read the guide on how to move and did everything according to the instructions. Unfortunately, only the up arrow works. Asking for help and clarification.

My project:

https://scratch.mit.edu/projects/850749202/
It's because it's checking if you are pressing down arrow inside of the checking for up arrow.
And you're checking for right arrow inside of the checking for down arrow.
And you're checking for left arrow inside of the checking for right arrow.
It should be like this:
when green flag clicked
forever
if <key [up arrow v] pressed?> then
point in direction (0)
move (2) steps
end
if <key [down arrow v] pressed?> then
point in direction (-180)
move (2) steps
end
if <key [right arrow v] pressed?> then
point in direction (-90)
move (2) steps
end
if <key [left arrow v] pressed?> then
point in direction (90)
move (2) steps
end
end
medians
Scratcher
1000+ posts

Problem with move

Also, if you want it to face in the way that you're moving in (including up and down), you can do this with the rotation styles:
SalazarRiddle
New Scratcher
2 posts

Problem with move

Thanks all of you for help. Of course now everything works correctly

Powered by DjangoBB