Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to I make a sprite glide around randomly?
- crazydoglady31
-
15 posts
How to I make a sprite glide around randomly?
I want to make it where a bunch of sprites are just floating around randomly. (like in the game slither) How can I make that script?
- ELevell
-
100+ posts
How to I make a sprite glide around randomly?
Try something like this:
Let me know if this helps!
forever
glide (1) secs to x: (pick random (-240) to (240)) y: (pick random (180) to (-180))
end
Let me know if this helps!
Spelling is
chalanging
difucult
hard.
- duckboycool
-
1000+ posts
How to I make a sprite glide around randomly?
What do you mean by floating around randomly. What I'm thinking of does not happen in slither.io.
If that's what you mean, you should also have a pick random .5 to 3 in the secs to make it more random.
If that's what you mean, you should also have a pick random .5 to 3 in the secs to make it more random.
Last edited by duckboycool (Jan. 27, 2017 01:48:38)
I used to be active on the forums, but I have mostly moved past Scratch. I still do check my Scratch messages, so if you'd like to talk to me, just leave a comment on my profile. My main project on Scratch was Cookie Clicker, but my newest project is Snake Snake, a game based off of Snake, but with two snakes, and you can play either singleplayer or multiplayer.

- DominoDragon1
-
1000+ posts
How to I make a sprite glide around randomly?
This is the same thing, but the sprite will always move the same speed, I think.
y: y(the variable)
The something should be a number you play around with to get the speed you want.
Hope I helped!
foreverLast part was cut off, it should be:
set [x] to (pick random (-240) to (240))
set [y] to (pick random (-180) to (180))
glide ((Something) * ([sqrt] of (([square] of ((x) - (y))) + ([square] of ((x position) - (y position)))))) secs to x: (x) y: (y)
end
y: y(the variable)
The something should be a number you play around with to get the speed you want.
Hope I helped!
Last edited by DominoDragon1 (Jan. 27, 2017 01:58:53)
There are 10 kinds of people in the world, those who know binary and those who don't. “And those who think they do but are still waiting on 8 more people.” (Sigton).

- ELevell
-
100+ posts
How to I make a sprite glide around randomly?
Thank you! did it
Nice work! Which script did you use?
Spelling is
chalanging
difucult
hard.
- crazydoglady31
-
15 posts
How to I make a sprite glide around randomly?
when green flag clicked
forever
go to x: (pick random () to (10)) y: ((pick random () to (10))
end
Last edited by crazydoglady31 (Jan. 27, 2017 18:26:40)
- DominoDragon1
-
1000+ posts
How to I make a sprite glide around randomly?
This would make the sprite move all over the place randomly, not gliding there.when green flag clicked
forever
go to x: (pick random () to (10)) y: ((pick random () to (10))
end
There are 10 kinds of people in the world, those who know binary and those who don't. “And those who think they do but are still waiting on 8 more people.” (Sigton).

- crazydoglady31
-
15 posts
How to I make a sprite glide around randomly?
i dont know for sure how to fix that but its ok
- Bentton
-
53 posts
How to I make a sprite glide around randomly?
If you want it to bounce around, use this script:
when green flag clickedOtherwise, If you want it to glide around do what ELevell said:
point in direction (pick random (-90) to (270))
go to x: (0) y: (0)
set rotation style [don't rotate]
forever
move (10) steps
if on edge, bounce
end
Try something like this:forever
glide (1) secs to x: (pick random (-240) to (240)) y: (pick random (180) to (-180))
end
Let me know if this helps!
- KoenigseggRS
-
2 posts
How to I make a sprite glide around randomly?
That helped. If you want it to bounce around, use this script:when green flag clickedOtherwise, If you want it to glide around do what ELevell said:
point in direction (pick random (-90) to (270))
go to x: (0) y: (0)
set rotation style [don't rotate]
forever
move (10) steps
if on edge, bounce
endTry something like this:forever
glide (1) secs to x: (pick random (-240) to (240)) y: (pick random (180) to (-180))
end
Let me know if this helps!

- C4-4life
-
3 posts
How to I make a sprite glide around randomly?
but what if your sprite starts at 0,0
- AmberPandax1212
-
1 post
How to I make a sprite glide around randomly?
well i think that it depend on who u are a if u are controlly a f or m yeh school is boring thats why im here
- SuperSean12
-
500+ posts
How to I make a sprite glide around randomly?
(deleted because i didnt know this was an old topic)
Last edited by SuperSean12 (Aug. 17, 2020 10:06:09)
@SuperSean12
forum translator
among us player
meme lover (not animation memess)
forum translator
among us player
meme lover (not animation memess)
- Fadelplayz
-
18 posts
How to I make a sprite glide around randomly?
Guys, I think we are necroposting around here
Hi There, I am Fadelplayz. What, you don't know me, well, I am a few things
-Animator
-Game Developer
-Been on Scratch for a Year
-Likes to Play Pokemon TCG
-100 Followers
- CodeCorps
-
22 posts
How to I make a sprite glide around randomly?
glide (1) secs to [random position]
Last edited by CodeCorps (Dec. 23, 2020 20:05:26)
- Discussion Forums
- » Help with Scripts
-
» How to I make a sprite glide around randomly?