Discuss Scratch

stsafan
New Scratcher
3 posts

My sprite won't move!

Ive followed all the lesson plans and my sprites still wont move.
I have selected the option to begin script when green flag is pressed but nothing happens (just shows a picture of my sprites and backdrop but no movement or sounds!) Please help! Ive been at this all day :'(
Caiden2000
Scratcher
41 posts

My sprite won't move!

Post your code/script so we can see what's going wrong.

This'll get your sprite to move nonsop and without control, it's the simplest script ever:
when green flag clicked
forever
move (5) steps
end

And THIS one'll make your sprite move left with the left arrow key and right with the right arrow key:

when green flag clicked
forever

if <key [left arrow] pressed?> then

move (-5) steps
end
if <key [right arrow] pressed?> then
move (5) steps
end

end

Note the forever loop. If you don't have that, the script will only check once if the arrow keys are down, and then stop.
Thepuzzlegame
Scratcher
1000+ posts

My sprite won't move!

Make sure your sprite is showing by using these blocks:
show
set [ghost v] effect to (0)
stsafan
New Scratcher
3 posts

My sprite won't move!

Thanks for the replies! Really want to get this done!!

Ok I dont think I have the ‘forever’ option on mine but I have all the other boxes I want re motion and sound etc!

I have shared my project! Im new to this so im hoping that means you can see what im doing wrong?

I just copied the link……..
http://scratch.mit.edu/projects/25384440/

Maybe that will work?

Any help greatly appreciated!

Thanks
Theprodigy
Scratcher
100+ posts

My sprite won't move!

Ok first of all, I recommend centering all of your sprites unless the centering you've done is what you want to keep (If you need help with that just ask).
Next, I'm not sure what this is for but in Sam2 you have a section of code that looks like this:
forever
point towards <touching [Bananas v]?>
point towards <touching [index v]?>
end
This will not do anything as the touching block outputs a boolean, and the point towards block requires an existing sprite, which can be chosen from the drop down menu, that the block contains by itself. If you are making an animation, which is what this project looks like, you won't usually have forever blocks you will use repeat blocks.

For movement you can these blocks:
move (...) steps // this one moves the sprite in the direction of the sprite
go to x: (...) y: (...) // this "instantaneously" moves the sprite to a location
go to [... v] //this block moves the sprite to the location of another sprite
glide (...) secs to x: (...) y: (...) //this is used to move a sprite over a period of time to a location
//^ [good for use in animations]
change x by (...) //the next 4 blocks are axis based changes either in the x or y direction,
//^ again this is immediate
set x to (...)
change y by (...)
set y to (...)
for smooth rotations you can use:
repeat (...)
turn ccw (...) degrees
end
You don't currently have any sound scripts that get a chance to run. The one in “index” isn't attached to a header, and so it won't ever run.

Hope this helps; I know this is a lot, and if you have any more question just ask.

Last edited by Theprodigy (Aug. 11, 2014 16:59:29)

stsafan
New Scratcher
3 posts

My sprite won't move!

Thanks so much Theprodigy.

Here is what im trying to do:
Ok, Sam will say hello and explain that he is going to show you how to make a banana milkshake. He will outline the ingredients that are required. Then he will lift up each ingredient to make sure he has it! He will then have five speech bubbles: No.1 will state: ‘Chop and Mash the bananas. No.2: Pour milk into the glass. No.3: Add the banana’s to the milk. No.4: Mix/Stir for two minutes. No.5: Drink and enjoy.

The only sound effect I want to use is a ‘pouring’ sound when Sam pours the milk into the glass. Also Sam will need to bring the milk to the glass.

I would be grateful if you could help with these parts?

Also I have no idea how to centre the sprites!?!?


Any help would be greatly appreciated.

Many Thanks
Theprodigy
Scratcher
100+ posts

My sprite won't move!

to center you sprites, click on the sprite -> go to costumes -> you should see three buttons in the top right corner of the editor, click the one that has two perpendicular lines with a dot at their intersection -> the paint editor should now have intersecting lines on it, if you click and hold your mouse down, you'll notice that the intersection is now locked to your mouse -> drag you mouse so that it is at the center of your sprite, and release the mouse, the object should now be at the center of the paint editor and you are done. (note: when you do this the object is going to move from its original spot in the display, you can just move it back).

You seem to have the speaking down. When checking the ingredients, I recommend using a broadcast block like this:
when green flag clicked //main animation script in Sam2
...
broadcast [check Milk v]
say [Checking for Milk] for (1) secs // I recommend this as opposed to say [] and wait (...) secs since it's less code
say [got it] for (2) secs
...
Then in the milk sprite put this code:
when I receive [check Milk v]
glide (1) secs to x: [x of Sam2's hand] y: [y of Sam2's hand]
wait (1) secs
glide (1) secs to x: [x of spot on counter] y: [y of spot on counter]
repeat this for each ingredient, using different broadcast names. You can change the numbers to whatever you want.

for subsequent movement of other sprites (i.e. pouring of milk, moving of bananas, etc.) use broadcasts.
NeoGlitch
New Scratcher
5 posts

My sprite won't move!

Hello. I'm having a similar problem. None of my sprites are moving. They change costumes on command, but they don't move at all. Everything else moves just fine.

http://scratch.mit.edu/projects/46449424/#player

I'M SO CONFUSED!

Thanks,
NeoGlitch
deck26
Scratcher
1000+ posts

My sprite won't move!

NeoGlitch wrote:

Hello. I'm having a similar problem. None of my sprites are moving. They change costumes on command, but they don't move at all. Everything else moves just fine.

http://scratch.mit.edu/projects/46449424/#player

I'M SO CONFUSED!

Thanks,
NeoGlitch
Best to start your own topic.

In your case you need to watch your forever loops. Your mirror sprite, for example has a forever loop that is effectively not doing anything once it has run once.

The main problem is the way you're handling your levels. The stage is broadcasting the level repeatedly and when you broadcast level1 the sprite is put back in its starting spot so it can never really move far before being put back!

Only broadcast a level change when one actually needs to happen. And watch your use of forever!

Powered by DjangoBB