Discuss Scratch

happykidofmath626
Scratcher
34 posts

How to stop a sprite from keep going?

Please, we need your information for this. How do we do this?
snezitko
Scratcher
100+ posts

How to stop a sprite from keep going?

you mean the sprite cant go more say to the right than set amount? this should help then:

when green flag clicked
forever
if <(x position) > (number)> then
set x to (number)
end
end
unicorncandyy6
Scratcher
19 posts

How to stop a sprite from keep going?

Tell us the project link for further help.
happykidofmath626
Scratcher
34 posts

How to stop a sprite from keep going?

The thing is……the project is unshared
unicorncandyy6
Scratcher
19 posts

How to stop a sprite from keep going?

Well then we cannot help unless you specify more information.
happykidofmath626
Scratcher
34 posts

How to stop a sprite from keep going?

NEW: EXAMPLE: When the player has a automatic cutscene, they quickly go to the next scene to hurry up. and when you play. the player keeps going even when you are not pressing any keys.
Mini_Man2013
Scratcher
100+ posts

How to stop a sprite from keep going?

heres a example:
when green flag clicked
forever
if <key [right v] pressed?> then
change x by (-4)
end
if <key [left v] pressed?> then
change x by (4)
end
end

just one note: i dont know position very well so that is the best i could do
Spentine
Scratcher
1000+ posts

How to stop a sprite from keep going?

You can store the player's input (the input to the player) using a list of inputs. This can be up, left, right, and down.

You can map the user's input to the player's input when they're playing, but during a cutscene, disable the user's control of the list and use arbitrary code to control the inputs.

To move right, you may use something like this:

when I receive [cutscene v]
set [player can control? v] to (0)
replace item (1) of [inputs v] with (0)
replace item (2) of [inputs v] with (0)
replace item (3) of [inputs v] with (1)
wait (4) secs
replace item (3) of [inputs v] with (0)
set [player can control? v] to (1)

but your code may turn out differently in the end.
happykidofmath626
Scratcher
34 posts

How to stop a sprite from keep going?

Mini_Man2013 wrote:

heres a example:
when green flag clicked
forever
if <key [right v] pressed?> then
change x by (-4)
end
if <key [left v] pressed?> then
change x by (4)
end
end

just one note: i dont know position very well so that is the best i could do

Well in the if bracket of right arrow, It's supposed to be change x by 4 not -4 and for the if bracket of the left arrow, it's change x by -4
medians
Scratcher
1000+ posts

How to stop a sprite from keep going?

Well, you could use this block:

Or you could use a variable to act as a sensor for which scripts are supposed to be stopped:

Just set it to a certain value before it has stopped and set it to another value when it has. If you want it to then continue again, set it to whatever value it was previously.
If you mean something else, you can state what you mean here.

happykidofmath626 wrote:

NEW: EXAMPLE: When the player has a automatic cutscene, they quickly go to the next scene to hurry up. and when you play. the player keeps going even when you are not pressing any keys.
Can you send the link to the project if your player is still moving? Make sure that the project is shared first by clicking the orange share button if you haven't.
Mini_Man2013
Scratcher
100+ posts

How to stop a sprite from keep going?

happykidofmath626 wrote:

Mini_Man2013 wrote:

heres a example:
when green flag clicked
forever
if <key [right v] pressed?> then
change x by (-4)
end
if <key [left v] pressed?> then
change x by (4)
end
end

just one note: i dont know position very well so that is the best i could do

Well in the if bracket of right arrow, It's supposed to be change x by 4 not -4 and for the if bracket of the left arrow, it's change x by -4

oh ok thx for reminding me

Powered by DjangoBB