Discuss Scratch

loneygamer
New Scratcher
4 posts

how do i stop my sprite from changing costumes when its not moving

I'm trying to make a game and the character moves from side to side (hes running) but how do i stop it changing costumes when hes not moving (which way its moves is controlled by a and d
SpaceDragon1
New Scratcher
100+ posts

how do i stop my sprite from changing costumes when its not moving

You can build the costume changes into the movement directly.
ifkeyapressed?thenpointindirection-90move5stepsnextcostume

You will most likely have to change my script a little bit to fit your program.
loneygamer
New Scratcher
4 posts

how do i stop my sprite from changing costumes when its not moving

would you need a forever loop on that?
SpaceDragon1
New Scratcher
100+ posts

how do i stop my sprite from changing costumes when its not moving

Yes, otherwise it would only check once, and would not continually check. You can stack them within the forever block:
foreverifkeyapressed?then. . .ifkeydpressed?then. . .
loneygamer
New Scratcher
4 posts

how do i stop my sprite from changing costumes when its not moving

thank you it worked but there is still a little problem if you stop it stops mid animation and dose not go back to the first one how do i fix
-ShadowOfTheFuture-
Scratcher
1000+ posts

how do i stop my sprite from changing costumes when its not moving

loneygamer wrote:

thank you it worked but there is still a little problem if you stop it stops mid animation and dose not go back to the first one how do i fix

You could add this in the forever loop:

ifnotkeyapressed?orkeydpressed?thenswitchcostumetoidle costume
SpaceDragon1
New Scratcher
100+ posts

how do i stop my sprite from changing costumes when its not moving

Also in that forever loop, you can put something like
ifnotkeyapressed?orkeydpressed?thenswitchcostumetoFirst Costume

Edit: ninja

Last edited by SpaceDragon1 (Dec. 22, 2017 21:36:03)

loneygamer
New Scratcher
4 posts

how do i stop my sprite from changing costumes when its not moving

thanks for the help (it worked)
donutcatpizza
Scratcher
1 post

how do i stop my sprite from changing costumes when its not moving

i made a game with a Christmas tree and a change button but when i place the garland onto the Christmas tree it still changes when i change the othera
Ultraman_Ace
Scratcher
10 posts

how do i stop my sprite from changing costumes when its not moving

Could someone help me pls? Why does my sprite move around when I change its costume?
Kiska-7275
Scratcher
1000+ posts

how do i stop my sprite from changing costumes when its not moving

Ultraman_Ace wrote:

Could someone help me pls? Why does my sprite move around when I change its costume?
Please do not necropost, instead, create a new topic for your question. Thanks!
Jlerpy
Scratcher
1000+ posts

how do i stop my sprite from changing costumes when its not moving

Ultraman_Ace wrote:

Could someone help me pls? Why does my sprite move around when I change its costume?

Are the costumes centred differently? That's usually the cause, from my little experience.
cgod2027
Scratcher
1 post

how do i stop my sprite from changing costumes when its not moving

didn't mean to make a message in this

Last edited by cgod2027 (Nov. 11, 2022 19:11:32)

TheWeeklyReader
Scratcher
100+ posts

how do i stop my sprite from changing costumes when its not moving

donutcatpizza wrote:

i made a game with a Christmas tree and a change button but when i place the garland onto the Christmas tree it still changes when i change the othera
please do not necropost

Powered by DjangoBB