View Full Version : moving on the screen
tyliang
07-17-2008, 01:11 AM
I'm a new flash user and I'm finding how to do a picture to move randomly on the screen. Something like falling leaves.
papastiffy
07-25-2008, 04:05 AM
Do you mean fall realistically like a leaf?
Or do you mean randomly such as appearing randomly around the screen?
papastiffy
07-25-2008, 04:09 AM
Well let me just try and answer them both while im here.
To make it randomly appear on the screen, just set the _x and _y of the sprite to equal random(10) or somthing. Put this so it sets itself new in every frame, like an onEnterFrame event.
To make it fall like a leaf... hmm, leme think...
Well you could increment the _y value slowly and then just have the _x randomly and slowly increment back and forth. So in other words, slowly adds a random number, then slowly subtracts a different random number and so on.
Hope that helps! :)
Oh and sorry for the double-post.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.