Something like this?
// press spacebar to randomly move the sprite and watch the particles follow
// set window properties
SetWindowSize( 640, 480, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 640, 480 ) // doesn't have to match the window
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
// create a sprite
CreateSprite(1,0)
SetSpriteSize(1,20,20)
SetSpriteOffset(1,10,10)
// set an initial position for the sprite
sprite_xp# = random(10,630)
sprite_yp# = random(10,470)
// create some particles
particle_xp# = sprite_xp#
particle_yp# = sprite_yp#
CreateParticles(1, particle_xp#, particle_yp#)
SetParticlesFrequency ( 1, 50 )
SetParticlesLife ( 1, 3 )
SetParticlesSize ( 1, 2 )
do
// press the space button to reposition the sprite in a random location
if GetButtonPressed(1) = 1
// determine new position of sprite
sprite_xp# = random(10,630)
sprite_yp# = random(10,470)
// determine the movement direction of the particles
speed# = 20
angle# = ATan2(sprite_xp# - particle_xp#, sprite_yp# - particle_yp#)
particle_move_x# = speed#*sin(angle#)
particle_move_y# = speed#*cos(angle#)
endif
// position the sprite
SetSpritePositionByOffset(1, sprite_xp#, sprite_yp#)
// move and position particle (only move particle if it is far enough away from the sprite)
if abs(particle_xp# - sprite_xp#) > 10
particle_xp# = particle_xp# + particle_move_x#
endif
if abs(particle_yp# - sprite_yp#) > 10
particle_yp# = particle_yp# + particle_move_y#
endif
SetParticlesPosition(1, particle_xp#, particle_yp#)
sync()
loop
It gets a little unstable if you increase the speed# of the particles but I'm sure that can be sorted out if you wanted them to move faster.