Can Anyone Show me How To Make e.g 6 characters scroll in a random direction in a 3x3 environment.
3x3 meaning 3 different areas as your X
3 different areas as your Y
An awesome example is Virtual Villagers
PS my theme is based on that
Offline
<First create the environment. A simple example of that can be found here. Making the 6 characters scroll is a little more complicated. As you're using a random direction, you'll need to find the x and y components of their resultant movement. This can be done with trigonometry. Find the x and y components like this.
set [x v] to ((V) * (cos (direction))) set [y v] to ((V) * (sin (direction)))where V is the speed/velocity of the character.
go to x: (0) y: (0) point in direction (pick random (-180) to (180)) set [x v] to (0) set [y v] to (0) forever change [x v] to ((V) * (cos (direction))) change [y v] to ((V) * (sin (direction))) set x to ((scrollx) - (x)) set y to ((scrolly) - (y)) if <<((abs (x position)) > (240))> or <((abs (y position)) > (180))>> hide else show end endI hope this is what you were looking for
Last edited by Prestige (2012-08-26 13:55:48)
Offline
Prestige wrote:
<First create the environment. A simple example of that can be found here. Making the 6 characters scroll is a little more complicated. As you're using a random direction, you'll need to find the x and y components of their resultant movement. This can be done with trigonometry. Find the x and y components like this.
set [x v] to ((V) * ([cos v] of (direction))) set [y v] to ((V) * ([sin v] of (direction)))where V is the speed/velocity of the character.
You'd then need to make this work in the scrolling environment. Construct a script like this:go to x: (0) y: (0) point in direction (pick random (-180) to (180)) set [x v] to (0) set [y v] to (0) forever change [x v] by ((V) * ([cos v] of (direction))) change [y v] by ((V) * ([sin v] of (direction))) set x to ((scrollx) - (x)) set y to ((scrolly) - (y)) if <<([abs v] of (x position)) > (240)> or <(180) < ([abs v] of (y position))>> hide else show end endI hope this is what you were looking for
Fixed!
Offline
Could you explain further what you're looking for?
Offline