# Moving clouds

**URL:** <https://forum.kirupa.com/t/moving-clouds/64549>\
**Category:** Uncategorized\
**Created:** [September 17, 2004, 1:07pm UTC](https://forum.kirupa.com/t/moving-clouds/64549 "2004-09-17T13:07:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fidelity88](https://avatars.discourse-cdn.com/v4/letter/f/7feea3/32.png) [@Fidelity88](https://forum.kirupa.com/u/Fidelity88)\
**Post date:** [September 17, 2004, 1:07pm UTC](https://forum.kirupa.com/t/moving-clouds/64549/1 "2004-09-17T13:07:23Z")

</div>

Hey, Im working on making a moving cloud effect right now. My question is this. When the cloud reaches the edge of the screen. to go back to the other side and come in. These clouds will be in the background of the page.  
Thanks!  
Fidelity

---

<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:** [September 17, 2004, 1:18pm UTC](https://forum.kirupa.com/t/moving-clouds/64549/2 "2004-09-17T13:18:03Z")

</div>

Do a board seach for continuous scrolling backgrounds/MCs or just crawl the web for the same keywords. (I believe there’s even an article on [kirupa.com](http://kirupa.com))

---

<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:** [September 17, 2004, 1:49pm UTC](https://forum.kirupa.com/t/moving-clouds/64549/3 "2004-09-17T13:49:56Z")

</div>

eh… I learned this some time ago, around here… or somewhere. I don’t know if it’s as effective as the one posted above.

This could be set in your Cloud mc.  
Assuming your cloud is moving from left to right.

Frame 1 - Define the edges of your stage. Since clouds are usually moving horizontally, you only need to define the left and right edges. Then you define the speed you want your cloud to move yet.

left\_edge = 0;  
right\_edge = 540;  
speed = -5;

Frame 2 - What happens when the cloud hits one of the edges? It wraps to the other!

\_x += speed;  
if(\_width+x \< left\_edge){  
\_x = \_width+right\_edge;  
}

Frame 3 - Constantly checking to see if the cloud is hitting the left all and keeps the cloud moving  
gotoAndPlay(2);

Please re-read this post, I did a bit of editing -\_-

---

<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:** [September 17, 2004, 4:34pm UTC](https://forum.kirupa.com/t/moving-clouds/64549/4 "2004-09-17T16:34:57Z")

</div>

eh… I learned this some time ago, around here… or somewhere. I don’t know if it’s as effective as the one posted above.

This could be set in your Cloud mc.  
Assuming your cloud is moving from left to right.

Frame 1 - Define the edges of your stage. Since clouds are usually moving horizontally, you only need to define the left and right edges. Then you define the speed you want your cloud to move yet.

left\_edge = 0;  
right\_edge = 540;  
speed = -5;

Frame 2 - What happens when the cloud hits one of the edges? It wraps to the other!

\_x += speed;  
if(\_width+\_x \< left\_edge){  
\_x = \_width+right\_edge;  
}

Frame 3 - Constantly checking to see if the cloud is hitting the left all and keeps the cloud moving

gotoAndPlay(2);

Please re-read this post, I did a bit of editing -\_-
