Discuss Scratch

ari_v
New Scratcher
9 posts

How do you change costumes while moving?

I already figured out how to move, but I am having trouble changing costumes, while I move. Not when it stops. Please Help!
Here is the link> https://scratch.mit.edu/projects/100200428/#editor
deck26
Scratcher
1000+ posts

How do you change costumes while moving?

You could just add a ‘next costume’ after each change of x or y.
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

thanks
ToastDemon
Scratcher
47 posts

How do you change costumes while moving?

ari_v wrote:

thanks

However, if you notice your player is moving too fast and you're not satisfied with it, there IS a way to slow it down.

repeat (as many times as you want)
next costume
wait (0.05) secs

end
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

I have another question, how do you change direction when going back? https://scratch.mit.edu/projects/100200428/#editor
deck26
Scratcher
1000+ posts

How do you change costumes while moving?

ari_v wrote:

I have another question, how do you change direction when going back? https://scratch.mit.edu/projects/100200428/#editor
When you know you're moving left point in direction -90; when you know you're moving right point in direction 90.

So in the scripts that look for the left and right arrow keys include a ‘point in direction’ block.
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

Thank you, and I added a new costume for when I jump, but it does not stay on the line when I move. How do I make it so that costume3 only appears when I jump, and stay on the line? https://scratch.mit.edu/projects/100200428/#editor
crisostimo
Scratcher
500+ posts

How do you change costumes while moving?

Your walking costumes are the first two. Get rid of the forever loops around the left/right arrows and replace with the following. I'll show you two ways to do it, and you can pick the one that makes most sense to you

when [right arrow v] key pressed
change x by (3)
switch costume to ((((costume #) + (2)) mod (2)) + (1))

when [left arrow v] key pressed
change x by (-3)
if ((costume #) = (1)) then
switch costume to [costume2 v]
else
switch costume to [costume 1 v]
end

You can also get rid of that other forever with the following:

when [up arrow v] key pressed
set [gravity v] to (15)
switch costume to [costume3 v]
change y by (gravity)
repeat until <touching color [#000000] ?>
change [gravity v] by (-1)
change y by (gravity)
end
switch costume to [costume1 v]

I'm on a personal mission to teach new programmers to not use the forever block. I think this approach is a lot better.
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

I used the second one, but I do not want costume3 to be there when I walk. How can I fix that?
crisostimo
Scratcher
500+ posts

How do you change costumes while moving?

If you use the scripts I gave you it should never use costume3 when walking. You need to use my up arrow script to make that the case.

One possible improvement is instead of using “if costume # = 1” is to use “if costume # > 0”. This will help if you have a bug where you have not reset back from costume 3.

You might want to also think about what behavior you want when the user presses the left or right arrow keys while they are jumping.
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

How do you make a start screen that is accessible ? This is what I got so far—>https://scratch.mit.edu/projects/100200428/#editor
1kharvey
Scratcher
36 posts

How do you change costumes while moving?

you could add another script that is timed to the motion or have a message sent
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

How do I make it so that costume 1 appears only when you switch to backdrop 1? https://scratch.mit.edu/projects/100200428/#editor
deck26
Scratcher
1000+ posts

How do you change costumes while moving?

ari_v wrote:

How do I make it so that costume 1 appears only when you switch to backdrop 1? https://scratch.mit.edu/projects/100200428/#editor
One option would be to have a script to set the next costume. It should have a min and max costume number so that if changing to the next costume takes it outside its allowed range it sets the costume to the min. The switching to different backdrops should set the min (and max if necessary) to appropriate values.

Last edited by deck26 (April 1, 2016 16:27:57)

ari_v
New Scratcher
9 posts

How do you change costumes while moving?

How do you automatically go to the game over screen when you hit “angry potato”? https://scratch.mit.edu/projects/100200428/#editor
ari_v
New Scratcher
9 posts

How do you change costumes while moving?

Mark_Zoarob
New Scratcher
10 posts

How do you change costumes while moving?

How can I make a character change costumes between a certain range of costumes?
Please it is Urgent
RainbowGryphon
New Scratcher
4 posts

How do you change costumes while moving?

deck26 wrote:

ari_v wrote:

I have another question, how do you change direction when going back? https://scratch.mit.edu/projects/100200428/#editor
When you know you're moving left point in direction -90; when you know you're moving right point in direction 90.

So in the scripts that look for the left and right arrow keys include a ‘point in direction’ block.
nope tottaly wrong just brodcast what u wanna say and when u want hte backround to move all u have to do is when i recieve blank switch blan to blank there blankeringe
Wyan100
Scratcher
1000+ posts

How do you change costumes while moving?

RainbowGryphon wrote:

nope tottaly wrong just brodcast what u wanna say and when u want hte backround to move all u have to do is when i recieve blank switch blan to blank there blankeringe

This is a really old post, I'm sure that these people don't still need help after 4 years.
MouseClicks
Scratcher
4 posts

How do you change costumes while moving?

@Wyan100 this is a really old post, I'm sure that these people don't still need help after 4 years.

Powered by DjangoBB