Best way to randomly put a mc off stage?

Hi,

Wondering what the best way is to randomly put a mc off stage?

My movie is 400x300

So to put it on stage i would use something like

this._x = myRandom(0, 400);
this._y = myRandom(0,300);

function myRandom (minVal, maxVal) {
return minVal + Math.floor(Math.random() *(maxVal+1 - minVal));
}

So how can i convert it to an offstage function

Well, you could do the same, with an _x position between -300 and 0 or 400 and 700, and the same for _y, no?

pom :slight_smile:

thnks,

what was i thinking.

portfolioBtn._x = myRandom (-300, 0 || 400,700);
portfolioBtn._y = myRandom (-300,0 || 300, 700);

btw could you take a look at my other post

That || is highly suspicious. You’re better off randomly choosing between the 2 intervals :slight_smile: