Discuss Scratch

TacoFish009
Scratcher
8 posts

Sprite Movement Issues

My sprite will not move in scratch even though the script is


When (left arrow) is pressed move -10 steps
and
When (right arrow) is pressed move 10 steps

I have no other scripts in the sprite related to movement ,or placement, I just have costumes and when to show ,or hide.\
I checked other sprites and can't find out what is wrong!

The link is here it's a W.I.P http://scratch.mit.edu/projects/51052496/#player
TacoFish009
Scratcher
8 posts

Sprite Movement Issues

Also, the jump script is broke too.
TacoFish009
Scratcher
8 posts

Sprite Movement Issues

My sprite will not move ,or jump in scratch even though the script is


when [ left arrow] key pressed
move (-10) steps


When I click the buttons it moves left about 1 step really fast and then stops. This has never happened before.

It moves after I press stop, but when it starts it doesn't move.

Other sprites move when I press left or right but not this one.

I have no other scripts in the sprite related to movement ,or placement, I just have costumes and when to show ,or hide.

I checked other sprites and can't find out what is wrong!


The link is here it's a W.I.P http://scratch.mit.edu/projects/51052496/#player

Last edited by TacoFish009 (March 8, 2015 19:56:13)

TacoFish009
Scratcher
8 posts

Sprite Movement Issues


My sprite will not move ,or jump in scratch even though the script is


when left arrow
key pressed
move -10
steps

When I click the buttons it moves left about 1 step really fast and then stops. This has never happened before.

It moves after I press stop, but when it starts it doesn't move.

I have no other scripts in the sprite related to movement ,or placement, I just have costumes and when to show ,or hide.

I checked other sprites and can't find out what is wrong!

The link is here it's a W.I.P http://scratch.mit.edu/projects/51052496/#player



EnderMitten
Scratcher
2 posts

Sprite Movement Issues

I'm not sure what the problem is, but try this out:

When left arrow key pressed
Forever
Point in direction -90 (for left)
Move 10 steps

Repeat this for the other controls.
I hope this helps, I studied the scripts of your game for a while, and this seems like the only way to fix it.



Last edited by EnderMitten (March 8, 2015 20:12:03)

EnderMitten
Scratcher
2 posts

Sprite Movement Issues

I answered this question a little earlier, but here it is in a little more detail. I don't know the problem, but try this script out.

when [ left arrow] key pressed
point in direction ( -90)
move (10) steps

Last edited by EnderMitten (March 8, 2015 20:20:25)

TacoFish009
Scratcher
8 posts

Sprite Movement Issues

he just flips upside down until I press left then he goes back to where he was at first
Cyoce
Scratcher
500+ posts

Sprite Movement Issues

The “When key pressed” event block is not ideal for controls. Try this instead:
when I receive [start v] //broadcast this when the game starts
set rotation style [left-right v] //this allows him to turn around
forever
if <key [left arrow v] pressed?> then
point in direction (-90 v)
move (10) steps
end
if <key [right arrow v] pressed?> then
point in direction (90 v)
move (10) steps
end
end
Cyoce
Scratcher
500+ posts

Sprite Movement Issues

when [left arrow v] key pressed
repeat until <not<key [left arrow v] pressed?>
point in direction (-90 v)
move (10) steps
end

The “when…” event blocks fire once, then pause, then fire continually. This is suboptimal for a control-scheme. By repeating the movement until the key is not pressed (i.e. released), you consistently move as long as the key is pressed.

Last edited by Cyoce (March 8, 2015 21:54:46)

mectro58
Scratcher
22 posts

Sprite Movement Issues

In order to make the sprite not turn when telling it to point in another direction you need to use the motion block
set rotation style [ None]
this should work
mectro58
Scratcher
22 posts

Sprite Movement Issues

Also here is a script that has worked better for me than the script your using to move the sprite.
when green flag clicked
forever

if <key [ left arrow] pressed?> then

point in direction ( -90)
move (-10) steps
end

end
Paddle2See
Scratch Team
1000+ posts

Sprite Movement Issues

Please don't make duplicate topics - it gets very confusing. I've merged all the ones I could find back into this one.

Just "bump" them by adding a new post to them if you want to bring them back to the top of the forum directory

Powered by DjangoBB