Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Random movement and sprite direction
- Pitchounette
-
6 posts
Random movement and sprite direction
Hi there,
How does one use random movement x and y but have the sprite face the right direction? The direction of the random movement? thanks and have a wonderful day.
How does one use random movement x and y but have the sprite face the right direction? The direction of the random movement? thanks and have a wonderful day.
- deck26
-
1000+ posts
Random movement and sprite direction
Rather than thinking of it as x and y movement think of it as an angle and a distance. Note that rotation style only needs to be set once unless you change it subsequently.
- Pitchounette
-
6 posts
Random movement and sprite direction
You are so nice and fast! But…I don't see set rotation style in my list of movement…
- Pitchounette
-
6 posts
Random movement and sprite direction
Oh and I would like them to glide
- peppermintpatty5
-
1000+ posts
Random movement and sprite direction
set rotation style in my list of movement…Are you using Scratch 1.4? If so, you can change the rotation style using the three buttons located slightly under the “file” button. You are so nice and fast! But…I don't see
- deck26
-
1000+ posts
Random movement and sprite direction
In that case you want to glide to random x and y values, presumably. x goes from -240 to 240, y from -180 to 180 so you can put those values in two random blocks. Oh and I would like them to glide
- Pitchounette
-
6 posts
Random movement and sprite direction
Are you using Scratch 1.4? If so, you can change the rotation style using the three buttons located slightly under the “file” button.
Maybe it is Scratch 1.4…I'm on linux and I installed it that way. I do use the three little buttons (only face left-right) but I don't want them to glide backwards!
- deck26
-
1000+ posts
Random movement and sprite direction
Ah, the problem I think you're referring to is that unlike ‘move’ the glide block doesn't turn the sprite. So what you probably want to do is get your random x and y coordinates, work out if x is greater than or less than the current value (and turn accordingly) then glide.Are you using Scratch 1.4? If so, you can change the rotation style using the three buttons located slightly under the “file” button.
Maybe it is Scratch 1.4…I'm on linux and I installed it that way. I do use the three little buttons (only face left-right) but I don't want them to glide backwards!
- Pitchounette
-
6 posts
Random movement and sprite direction
Thanks. I'll let you know if it works!
- Aqua_Cheetah123
-
6 posts
Random movement and sprite direction
Ok, so how would you make it only face 180 degrees or 90 degrees but randomly choose when I place it down
- imfh
-
1000+ posts
Random movement and sprite direction
Welcome to the Scratch forums! To keep things organized, it is usually preferable that you create a new topic to get help in Help With Scripts. This is especially the case when the topic is nearly 4 years old. Next time, please check the date before posting. Ok, so how would you make it only face 180 degrees or 90 degrees but randomly choose when I place it down
You can use this script to randomly choose 90 or 180 degrees:
- db3t
-
4 posts
Random movement and sprite direction
Rather than thinking of it as x and y movement think of it as an angle and a distance. Note that rotation style only needs to be set once unless you change it subsequently.
- Discussion Forums
- » Help with Scripts
-
» Random movement and sprite direction