Hi! I'm unsure how to check if one of my ball types has left the screen area. Do I have to loop through all my ball types, or is there a more clever way?
type BallType
sprId as integer //Sprite ID
endtype
balls as BallType[255]
for createBall = 1 to 20
balls[createBall].sprID = CreateSprite(ballImg) // Create the ball
SetSpriteActive(balls[createBall].sprID, 1)
SetSpriteVisible(balls[createBall].sprID, 1) // Set ball visible
SetSpriteSize(balls[createBall].sprID, 128.0, -1 )
SetSpritePositionByOffset (balls[createBall].sprID, random(GetScreenBoundsLeft()+100, GetScreenBoundsRight()-100), random(GetScreenBoundsTop()+100, GetScreenBoundsBottom()-100))
SetSpriteShapeCircle( balls[createBall].sprID, 0 ,0,64.0)
SetSpritePhysicsOn( balls[createBall].sprID, 2)
SetSpritePhysicsCanRotate( balls[createBall].sprID, 0 )
SetSpritePhysicsDamping( balls[createBall].sprID, 0.0)
SetSpritePhysicsRestitution( balls[createBall].sprID, 1.0 )
SetSpritePhysicsFriction( balls[createBall].sprID, 0.0 )
SetSpritePhysicsMass( balls[createBall].sprID, 1.0 )
SetSpritePhysicsIsBullet( balls[createBall].sprID, 1 )
SetSpritePhysicsImpulse(balls[createBall].sprID,GetSpriteXByOffset(balls[createBall].sprID),GetSpriteYByOffset(balls[createBall].sprID),random (500, 2500),random (500, 2500))
next