Q on how to do cloud movement

pretty simple question for most of you prolly… i’m still trying to wade myself through the Ocean of Actionscript ;p.

My basic layout is i got ground… and above the ground… i got a sky (pretty complex eh)

I got a few clouds up in the sky that i just want to move to the right, and keep moving across the screen non-stop, i looked at most the tutorials with movement across the screen, but they coincided with mouse movement…and i dun want them to be affected by the mouse.

If someone could just point me in the right direction it’s be much appreciated =D

let’s make it interesting … lol

place this script in your maintimeline:

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:

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

the script will move the clouds at a random speed [1 - 4] to the right
when the mc is not visible anymore [at the right] … it will return to the other side [the left] and move again to the right

[size=1]**PS: **my scripting skills are not that good … so maybe someone can clear up the code for you[/size]

Hey man, I just tryed the code… It works amazing!

great work :slight_smile:

p.s. i know this wasnt my question but it’s still good to know :wink:

Hey can you post a URL of what he is trying to do??? SO i can see what he is doing and to see what it looks like???

*Originally posted by SureShot *
**Hey man, I just tryed the code… It works amazing!

great work :slight_smile:

p.s. i know this wasnt my question but it’s still good to know :wink: **

thanx!! :beam:

but surely there’s a better or easiest way to do that … i’ll try later
i’m a little busy right now :-\

nice footer sureshot!

well…here’s an .fla of what im doin wit the whole cloud thing…

i’m just experimenting around wit stuff, it’s just for our school site… it’s kinna cartooney but shrugs oh well.

edit: oops… almost forgot, thanx a lot for the script Kax =D

hey that’s pretty cool =)

glad you like the script :wink:

Thanks a lot :slight_smile: I am not the best in flash but I am learning!:asian:

how can you make the clouds move the opposite direction?

change the start position to the other end of the stage and subtract pixels instead of adding them

Peace

position the other end is not working…please help?

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.

any help on this??? Please…