# SpriteRayCastGroup

## Description

Casts a ray through all sprites that have a shape (including physics sprites) and stores the result of any intersection. Results of a ray cast can be retrieved using the other ray cast functions such as GetRayCastNormalX. Physics sprites will only use the main shape assigned to the sprite using SetSpriteShape, to check compound shapes use PhysicsRayCast.
If the ray starts inside a shape that shape will not be counted in the results. Sprites must be assigned a shape using one of the sprite shape commands or it will not be included in the collision results. This function is slower than the physics ray casts as it cannot make use of optimized structures that represent where the sprites are in the world relative to the ray.
This function filters the sprites that are checked so only sprites of a certain group are checked. By default sprites are created in group 0.
This function can only keep track of sprites created using CreateSprite, if you have manually allocated memory for sprites you will need to cycle through your list of sprites with SpriteRayCastSingle or use the physics version.
Returns 1 if there was a collision, 0 if not.

## Definition

integer SpriteRayCastGroup( group, x, y, x2, y2 )

int agk::SpriteRayCastGroup( int group, float x, float y, float x2, float y2 )

## Parameters

- group - The group ID to check for intersection with the ray, can be negative.
- x - The X coordinate of the start point in world coordinates.
- y - The Y coordinate of the start point in world coordinates.
- x2 - The X coordinate of the end point in world coordinates.
- y2 - The Y coordinate of the end point in world coordinates.