Discuss Scratch

sk321
New to Scratch
4 posts

Levels problem

I have a problem in my game Levels. When I put the scripts on how to move, and I moved it with the way the scripts showed me to, the square would move a lot sometimes, and a little some other times, even though I told it only to move 3 steps. Please help me. Here is the link(below).

Levels link
flun
Scratcher
85 posts

Levels problem

There are two ways you can fix the problem, pick whichever one you want:

1. Go to the costume editor for sprite 3 (the green one), look in the top right corner there should be a little plus sign with a dot in the middle so click that, then click the center of the green square. Problem solved.

2. Make it so it changes x by 3 when right pressed, changes x by -3 when left pressed, changes y by 3 when up pressed, and changes y by -3 when down pressed. Problem solved. (here Ill show you the script so it's easier)

when green flag clicked
forever

if <key [right arrow ] pressed?> then

change x by (3)
end
if <key [left arrow ] pressed?> then

change x by (-3)
end
if <key [up arrow ] pressed?> then

change y by (3)
end
if <key [down arrow ] pressed?> then

change y by (-3)
end

end

forever

start project
work on it
abandon it

end
ShadowScizor
Scratcher
100+ posts

Levels problem

The problem is in the
 point in direction ( v) 
block. This block will change the direction of the sprite in relative to the center of the sprite in the costume. And that cause the problem in your case.

There is two way to solve your problem:
1. Re-position the green block to the center in the costume
2. Instead of
point in direction ( v)
move () steps
,use
change x by ()
change y by ()

For example:
when [right arrow v] key pressed
change x by (3)

when [left arrow v] key pressed
change x by (-3)

when [up arrow v] key pressed
change y by (3)

when [down arrow v] key pressed
change y by (-3)
*Do not confuse x with y (x controls left and right, y controls up and down)

either method will work, if you still do not understand, feel free to clarify

Last edited by ShadowScizor (Dec. 31, 2014 03:39:48)

flun
Scratcher
85 posts

Levels problem

flun wrote:

There are two ways you can fix the problem, pick whichever one you want:

1. Go to the costume editor for sprite 3 (the green one), look in the top right corner there should be a little plus sign with a dot in the middle so click that, then click the center of the green square. Problem solved.

2. Make it so it changes x by 3 when right pressed, changes x by -3 when left pressed, changes y by 3 when up pressed, and changes y by -3 when down pressed. Problem solved. (here Ill show you the script so it's easier)

when green flag clicked
forever

if <key [right arrow ] pressed?> then

change x by (3)
end
if <key [left arrow ] pressed?> then

change x by (-3)
end
if <key [up arrow ] pressed?> then

change y by (3)
end
if <key [down arrow ] pressed?> then

change y by (-3)
end

end
The second option will make it run smoother than the first though.

forever

start project
work on it
abandon it

end
flun
Scratcher
85 posts

Levels problem

ShadowScizor wrote:

The problem is in the
 point in direction ( v) 
block. This block will change the direction of the sprite in relative to the center of the sprite in the costume. And that cause the problem in your case.

There is two way to solve your problem:
1. Re-position the green block to the center in the costume
2. Instead of
point in direction ( v)
move () steps
,use
change x by ()
change y by ()
either method will work, if you still do not understand, feel free to clarify
copier :p lol jk

forever

start project
work on it
abandon it

end
ShadowScizor
Scratcher
100+ posts

Levels problem

flun wrote:

ShadowScizor wrote:

The problem is in the
 point in direction ( v) 
block. This block will change the direction of the sprite in relative to the center of the sprite in the costume. And that cause the problem in your case.

There is two way to solve your problem:
1. Re-position the green block to the center in the costume
2. Instead of
point in direction ( v)
move () steps
,use
change x by ()
change y by ()
either method will work, if you still do not understand, feel free to clarify
copier :p lol jk
not copied, but a little late
flun
Scratcher
85 posts

Levels problem

ShadowScizor wrote:

flun wrote:

ShadowScizor wrote:

The problem is in the
 point in direction ( v) 
block. This block will change the direction of the sprite in relative to the center of the sprite in the costume. And that cause the problem in your case.

There is two way to solve your problem:
1. Re-position the green block to the center in the costume
2. Instead of
point in direction ( v)
move () steps
,use
change x by ()
change y by ()
either method will work, if you still do not understand, feel free to clarify
copier :p lol jk
not copied, but a little late
hey, great minds think alike xD

forever

start project
work on it
abandon it

end
AonymousGuy
Scratcher
1000+ posts

Levels problem

You should still center the sprite no matter what to avoid further issues.

Powered by DjangoBB