This content has been marked as final. Show 2 replies
The loc is a sprite property that holds the horizontal and vertical position of the sprite. It is expressed in pixels and is called a point. For example:
-- point (5,16)
Random is a function that will return a random number between a minimum and maximum value. If only one value is given, then the random number will be between 1 and the number given. For example:
put random(3, 17)
The stageRight, and the stageLeft, the stageTop and the stageBottom, are properties of the staqe. Each of these properties will return the position of that edge of the stage on the user's monitor. To find out how wide the stage is, for example, you would subtract the stageLeft from the stageRight. There is, oddly enough, no built in property to describe the width or height of the stage. In any case, the calculation in your function is used to give the random function two numbers, with a difference of 500 pixels left to right and 400 pixels top to bottom.
The result is that sprite 2 will be positioned somewhere on the stage in a 500 by 400 pixel space on the stage.
When working with this sort of function, keep in mind that the registration point for a bitmap sprite will usually be at its center. So the center of the sprite will be positioned somewhere in that space, not necessarily the whole sprite.
Thank you very much for the help