Position Star and Call init();

Now let's set the _x property (horizontal position) of newStar to be a random number, somewhere on the stage. That won't be too bad because we already declared a variable equal to the width stage width (sW). So, we'll just generate a random number anywhere from 0 to the width of the stage: random(sW)

We are going to keep using set variable to set properties, and var to declare variables:

  1. Click Statements > Variables > set variable
  2. Type newStar._x in the Variable box
  3. Type random(sW) in the Value box

Repeat the process to set the y position of newStar, but this time use sH (the variable you set equal to the stage height):

OK, nothing visible is going to happen until you actually call that init function:

  1. Select the numStars variable declaration... the new script should come right after this
  2. Click Deprecated > Actions > call function
  3. Type init in the Function box

If you test your work now, you should find a single star placed randomly (somewhere on the stage). Test repeatedly to see your star pop around: