Discuss Scratch

Scratcher
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
Scratcher
100+ posts

How to I make a sprite glide around randomly?

Try something like this:

`foreverglide (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
Scratcher
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.

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, 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
Scratcher
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.

`foreverset [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`
Last part was cut off, it should be:
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).
Scratcher
15 posts

How to I make a sprite glide around randomly?

Thank you! did it
ELevell
Scratcher
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.
Scratcher
15 posts

How to I make a sprite glide around randomly?

`when green flag clickedforevergo to x: (pick random () to (10)) y: ((pick random () to (10))end`

Last edited by crazydoglady31 (Jan. 27, 2017 18:26:40)

DominoDragon1
Scratcher
1000+ posts

How to I make a sprite glide around randomly?

`when green flag clickedforevergo to x: (pick random () to (10)) y: ((pick random () to (10))end`
This would make the sprite move all over the place randomly, not gliding there.

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).
Scratcher
15 posts

How to I make a sprite glide around randomly?

i dont know for sure how to fix that but its ok
Bentton
Scratcher
53 posts

How to I make a sprite glide around randomly?

If you want it to bounce around, use this script:
`when green flag clickedpoint in direction (pick random (-90) to (270))go to x: (0) y: (0)set rotation style [don't rotate]forevermove (10) stepsif on edge, bounceend`
Otherwise, If you want it to glide around do what ELevell said:

ELevell wrote:

Try something like this:

`foreverglide (1) secs to x: (pick random (-240) to (240)) y: (pick random (180) to (-180))end`

Let me know if this helps!
KoenigseggRS
Scratcher
2 posts

That helped
KoenigseggRS
Scratcher
2 posts

How to I make a sprite glide around randomly?

Bentton wrote:

If you want it to bounce around, use this script:
`when green flag clickedpoint in direction (pick random (-90) to (270))go to x: (0) y: (0)set rotation style [don't rotate]forevermove (10) stepsif on edge, bounceend`
Otherwise, If you want it to glide around do what ELevell said:

ELevell wrote:

Try something like this:

`foreverglide (1) secs to x: (pick random (-240) to (240)) y: (pick random (180) to (-180))end`

Let me know if this helps!
That helped.
C4-4life
Scratcher
3 posts

How to I make a sprite glide around randomly?

but what if your sprite starts at 0,0
AmberPandax1212
New to Scratch
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
scratchbuilder247
Scratcher
48 posts

It is very easy

SuperSean12
Scratcher
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)
Scratcher
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
Scratcher
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)