you've got the idea, bluepixel. assign a random direction to each sprite via an array.
note the SpriteData
Type which contains the SpriteID and its specific Direction of travel so you can maintain their relationship.
Sprite would be your Array which contains each Sprite's "Data" above:
// Project: SpriteBurst
// Created: 2019-05-17
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "SpriteBurst" )
SetWindowSize( 1080, 720, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1080, 720 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
Type SpriteData
ID as Integer
DIR as Float
EndType
Sprite as SpriteData[20]
For x = 1 to 20
Sprite[x].ID = CreateSprite(0)
Sprite[x].DIR = Random(0,359)
ThisSprite = Sprite[x].ID
SetSpriteSize(ThisSprite,32,32)
SetSpritePosition(ThisSprite,524,344)
SetSpriteColor(ThisSprite,Random(0,255),Random(0,255),Random(0,255),255)
Next x
Speed# = 4.0
do
For x = 1 to 20
ThisSprite = Sprite[x].ID : ThisDir = Sprite[x].DIR
NewX# = GetSpriteX(ThisSprite) + COS(ThisDir)*Speed#
NewY# = GetSpriteY(ThisSprite) + SIN(ThisDir)*Speed#
SetSpritePosition(ThisSprite, NewX#, NewY#)
Next X
Print(ScreenFPS())
Sync()
loop
i tend to use "temp" variables such as
ThisSprite in the code above so i don't have to type, in this case,
Sprite[x].ID (over and over) so, don't let that throw you off; it's just my way. it's easier for me to "read"