Pages: 1
Topic closed
Does anyone know how to make an sprite move in different directions in random order?
Also, does anyone know how to make a sprite bounce off of a sprite it just touched?
Offline
do this:
when gf clicked wait <pick random (1) to (10)> secs go to x: <pick random (1) to (10)> y: <pick random (1) to (10)>Of course, you could put in different numbers.
Last edited by Mokat (2012-01-30 21:56:04)
Offline
when gf clicked go to (0) (0) point in direction (0) forever point in direction <(direction) + <pick random (-10) to (10)>> move (5) stepsThough the movement would be quite random and confusing. I'm sure there is a way to optimize the script so the object has a little more "focused" movement rather than turning in random directions without any "real intent", unless of course, you want it to be really odd. The "focused" movement is more for AIs, I guess.
Offline
To bounce an object off another:
when gf clicked forever if <touching [whateversprite v] ?> turn cw ((180)-(direction)) degrees end end
Last edited by fg123 (2012-01-31 02:40:14)
Offline
Here is to make it move when you click the sprite.
<when[Sprite1]clicked> <glide(1)secs to x:<pick random(-90)to(900)to y:<pick random(-90)to(900)>Also in my project Click-Ball.
Offline
fetchydog567 wrote:
Here is to make it move when you click the sprite.
when[Sprite1]clicked glide(1)secs to x:(pick random(-90)to(900)) y:(pick random(-90)to(900))Also in my project Click-Ball.
Fixed script.
Offline
Magnie wrote:
when flag clicked go to x: (0) y: (0) point in direction (0) forever point in direction ((direction) + (pick random (-10) to (10))) move (5) stepsThough the movement would be quite random and confusing. I'm sure there is a way to optimize the script so the object has a little more "focused" movement rather than turning in random directions without any "real intent", unless of course, you want it to be really odd. The "focused" movement is more for AIs, I guess.
Bouncing is probably one of the more complicated scripts in programming and for that, I'm not entirely sure.
Fixed.
Offline
Topic closed
Pages: 1