Discuss Scratch

Swampat
Scratcher
25 posts

Stop sprites from moving for a few seconds.

I'm trying to stop the mouse sprites after the hammer power up is touched. I want them to stop moving for a few seconds and then make them move again. If you have any ideas let me know.

Project: https://scratch.mit.edu/projects/175357890/
Swampat
Scratcher
25 posts

Stop sprites from moving for a few seconds.

Anyone?
mstone326
Scratcher
1000+ posts

Stop sprites from moving for a few seconds.

When you touch the hammer broadcast a message called freeze or something like that. You'll also have to create a variable to handle whether a script will run. The difficult part is all your repeat until loops that handle your movement. So you'll have to put the move condition inside each of your repeat until blocks.I put a comment tag on all the code I created as well as the new variable and broadcast. All changes are on mouse2 and hammer

I remixed with one done for you.

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

deck26
Scratcher
1000+ posts

Stop sprites from moving for a few seconds.

You should just be able to use a variable to keep track of the hammer state and then in the forever loop controlling movement wait until the variable is 0. If this is where you're using the ‘hammer’ broadcast instead try setting a variable to 1 and waiting your set time before setting it back to 0. The mouse sprites can then only move when hammer=0.
mstone326
Scratcher
1000+ posts

Stop sprites from moving for a few seconds.

Problem is inside the forever loop are a bunch of repeat until blocks. So when the loop variable changes, it doesn't trigger until the repeat until block has completed. I thought of stopping t he script but ended up putting an if pause = no inside each of the repeat until blocks.
Swampat
Scratcher
25 posts

Stop sprites from moving for a few seconds.

mstone326 wrote:

Problem is inside the forever loop are a bunch of repeat until blocks. So when the loop variable changes, it doesn't trigger until the repeat until block has completed. I thought of stopping t he script but ended up putting an if pause = no inside each of the repeat until blocks.
Thank you
coolmascateergirl
Scratcher
1 post

Stop sprites from moving for a few seconds.

how do I make my sprit to stop moving without it touching something?
ScratchCatHELLO
Scratcher
1000+ posts

Stop sprites from moving for a few seconds.

coolmascateergirl wrote:

how do I make my sprit to stop moving without it touching something?
Post this in your own topic.
crackerman1-10
Scratcher
72 posts

Stop sprites from moving for a few seconds.

coolmascateergirl wrote:

how do I make my sprit to stop moving without it touching something?
I want to learn that too.
Deyjonnay
New Scratcher
1 post

Stop sprites from moving for a few seconds.

coolmascateergirl wrote:

how do I make my sprit to stop moving without it touching something?

Im trying to figure this out too. Anyone?
hwlauf
Scratcher
100+ posts

Stop sprites from moving for a few seconds.

coolmascateergirl wrote:

how do I make my sprit to stop moving without it touching something?
what do you mean? do you mean in a platformer?
amazingscratchcoder
Scratcher
100+ posts

Stop sprites from moving for a few seconds.

Please make your own topic. Reported

Powered by DjangoBB