This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-07-26 18:07:12

dadeda
New Scratcher
Registered: 2011-07-26
Posts: 1

How do I make my sprite glide randomly?

okay so, on my game its Tacnyan vs Nyan cat, and the aim is to get to the otherside without touching one of the cats. I want the cat to glide randomly around and bounce off the walls and whatever so it can half block the other side and everything,please help!?D:

Offline

 

#2 2011-07-26 18:24:34

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: How do I make my sprite glide randomly?

[blocks]
<when green flag clicked>
<forever>
<if on edge, bounce>
<end>

<when green flag clicked>
<point in direction( <pick random( 1 )to( 360
<forever>
<move( 3 )steps>
<end>

Is this what you were looking for?  smile


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

#3 2011-07-26 18:29:06

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: How do I make my sprite glide randomly?

How about something like this:


<glide( <pick random( 1 )to( 3 )) )secs to x sad  <pick random( -180 )to( 180 )) )y sad  <pick random( -120 )to( 120 ))


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#4 2011-07-26 18:31:22

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: How do I make my sprite glide randomly?

BoltBait wrote:

How about something like this:


[blocks]<glide( <pick random( 1 )to( 3 )) )secs to x sad  <pick random( -180 )to( 180 )) )y sad  <pick random( -120 )to( 120 ))[/blocks]

[blocks]Don't forget to include <if on edge, bounce>[/blocks] though  tongue

The problem with glide is that the sprite will change speed constantly. Unless you want that, of course.


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

Board footer