# Cloud movement

**URL:** <https://forum.kirupa.com/t/cloud-movement/11070>\
**Category:** Uncategorized\
**Created:** [January 11, 2003, 3:33pm UTC](https://forum.kirupa.com/t/cloud-movement/11070 "2003-01-11T15:33:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dysan\_max](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@dysan\_max](https://forum.kirupa.com/u/dysan_max)\
**Post date:** [January 11, 2003, 3:33pm UTC](https://forum.kirupa.com/t/cloud-movement/11070/1 "2003-01-11T15:33:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 11, 2003, 3:37pm UTC](https://forum.kirupa.com/t/cloud-movement/11070/2 "2003-01-11T15:37:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 12, 2003, 12:51am UTC](https://forum.kirupa.com/t/cloud-movement/11070/3 "2003-01-12T00:51:20Z")

</div>

It has got to work:

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 12, 2003, 4:48pm UTC](https://forum.kirupa.com/t/cloud-movement/11070/4 "2003-01-12T16:48:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 13, 2003, 12:14am UTC](https://forum.kirupa.com/t/cloud-movement/11070/5 "2003-01-13T00:14:10Z")

</div>

Can’t you copy paste? :hangover:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 13, 2003, 1:30am UTC](https://forum.kirupa.com/t/cloud-movement/11070/6 "2003-01-13T01:30:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 13, 2003, 11:49am UTC](https://forum.kirupa.com/t/cloud-movement/11070/7 "2003-01-13T11:49:43Z")

</div>

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

Am I getting :crazy: or what?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 13, 2003, 8:52pm UTC](https://forum.kirupa.com/t/cloud-movement/11070/8 "2003-01-13T20:52:46Z")

</div>

did you try to make it in the opposite direction?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 13, 2003, 11:51pm UTC](https://forum.kirupa.com/t/cloud-movement/11070/9 "2003-01-13T23:51:33Z")

</div>

Well, yeah.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 14, 2003, 12:05am UTC](https://forum.kirupa.com/t/cloud-movement/11070/10 "2003-01-14T00:05:08Z")

</div>

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

Thanx.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 14, 2003, 3:00pm UTC](https://forum.kirupa.com/t/cloud-movement/11070/11 "2003-01-14T15:00:43Z")

</div>

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