how do I make the clouds move backward with this scripts?
place this script in your maintimeline:
code:--------------------------------------------------------------------------------MovieClip.prototype.moveMe = function (begin, end, speed) {
if (this._x <= end) {
this._x += speed
} else {
this._x = begin
}
}--------------------------------------------------------------------------------
now place this script in every cloud:
code:--------------------------------------------------------------------------------onClipEvent (load) {
var begin = (0 - (this._width / 2))
var end = (Stage.width + (this._width / 2))
var speed = Math.round (((Math.random() * 4) + 1))
}
onClipEvent (enterFrame) {
this.moveMe (begin, end, speed)
}
Thanx.
system
2
make speed a negative number and switch your begin and end (in the load event)
system
3
It has got to work:
MovieClip.prototype.moveMe = function (begin, end, speed) {
if (this._x >= end) {
this._x += speed
} else {
this._x = begin
}
}
// then in every cloud:
onClipEvent (load) {
var end = (0 - (this._width / 2))
var begin = (Stage.width + (this._width / 2))
var speed = -Math.round (((Math.random() * 4) + 1))
}
onClipEvent (enterFrame) {
this.moveMe (begin, end, speed)
}
system
4
I’ve just tried it and it works perfectly :trout:
system
5
Can’t you copy paste? :hangover:
system
6
i did that already…i want the clouds to move the opposite direction…
system
7
Then it’s the code you posted in the first post.
Am I getting :crazy: or what?
system
8
did you try to make it in the opposite direction?
system
10
Right now you have the cloud moving from left to right. I want the cloud to move from right to left.
Thanx.
system
11
Hi can you figure to move the clouds from right to left?