Cloud movement

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.

make speed a negative number and switch your begin and end (in the load event)

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)
}

I’ve just tried it and it works perfectly :trout:

Can’t you copy paste? :hangover:

i did that already…i want the clouds to move the opposite direction…

Then it’s the code you posted in the first post.

Am I getting :crazy: or what?

did you try to make it in the opposite direction?

Well, yeah.

Right now you have the cloud moving from left to right. I want the cloud to move from right to left.

Thanx.

Hi can you figure to move the clouds from right to left?