The PositionRandomlyInView sets the Position of a PositionedObject randomly inside the view of the Camera calling the method. This can be used to quickly place one or more objects at a random position in the Camera's view and is commonly used in debugging and simple test applications.


The following code creates 100 Sprites and places them randomly in the Camera's view. All Sprites are between 20 and 60 units in front of the Camera. Add the following in Initialize after initializing FlatRedBall

for (int i = 0; i < 100; i++)
    Sprite sprite = SpriteManager.AddSprite("redball.bmp");

    float minimumDistance = 20;
    float maximumDistance = 60;
        sprite, minimumDistance, maximumDistance);

Last updated