I had a spare hour at work - here you go
global spriteGroup as integer[-1,-1]
function CreateSpriteGroup()
spriteGroup.length = spriteGroup.length + 1
endfunction spriteGroup.length
function SetSpriteToGroup(s, g)
if not(GetSpriteExists(s))
message("SetSpriteToGroup() called"+chr(13)+"with illegal sprite ID"): end
endif
if g < 0 or g > spriteGroup.length
message("SetSpriteToGroup() called"+chr(13)+"with illegal group ID"): end
endif
spriteGroup[g].insert(s)
endfunction
function RemoveSpriteFromGroup(s, g)
if g < 0 or g > spriteGroup.length
message("RemoveSpriteFromGroup() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
if spriteGroup[g,k] = s
spriteGroup[g].remove(k)
exitfunction 1
endif
next k
endfunction -1
function FixSpriteGroupToScreen(g, mode)
if g < 0 or g > spriteGroup.length
message("FixSpriteGroupToScreen() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
FixSpriteToScreen(spriteGroup[g,k], mode)
next k
endfunction
function SetSpriteGroupActive(g, state)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupActive() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteActive(spriteGroup[g,k], state)
next k
endfunction
function SetSpriteGroupAdditionalImage(g, image, stage)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupAdditionalImage() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteAdditionalImage(spriteGroup[g,k], image, stage)
next k
endfunction
function SetSpriteGroupAngle(g, a#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupAngle() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteAngle(spriteGroup[g,k], a#)
next k
endfunction
function SetSpriteGroupAngleRad(g, a#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupAngleRad() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteAngleRad(spriteGroup[g,k], a#)
next k
endfunction
function SetSpriteGroupColor(g, r#, g#, b#, a#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupColor() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteColor(spriteGroup[g,k], r#, g#, b#, a#)
next k
endfunction
function SetSpriteGroupColorAlpha(g, a#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupColorAlpha() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteColorAlpha(spriteGroup[g,k], a#)
next k
endfunction
function SetSpriteGroupColorBlue(g, b#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupColorBlue() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteColorBlue(spriteGroup[g,k], b#)
next k
endfunction
function SetSpriteGroupColorGreen(g, g#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupColorGreen() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteColorGreen(spriteGroup[g,k], g#)
next k
endfunction
function SetSpriteGroupColorRed(g, r#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupColorRed() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteColorRed(spriteGroup[g,k], r#)
next k
endfunction
function SetSpriteGroupDepth(g, d)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupDepth() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteDepth(spriteGroup[g,k], d)
next k
endfunction
function SetSpriteGroupFlip(g, h, v)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupFlip() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteFlip(spriteGroup[g,k], h, v)
next k
endfunction
function SetSpriteGroupImage(g, image)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupImage() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteImage(spriteGroup[g,k], image)
next k
endfunction
function SetSpriteGroupOffset(g, x#, y#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupOffset() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteOffset(spriteGroup[g,k], x#, y#)
next k
endfunction
function SetSpriteGroupPosition(g, x#, y#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupPosition() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpritePosition(spriteGroup[g,k], x#, y#)
next k
endfunction
function SetSpriteGroupPositionByOffset(g, x#, y#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupPositionByOffset() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpritePositionByOffset(spriteGroup[g,k], x#, y#)
next k
endfunction
function SetSpriteGroupScale(g, x#, y#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupScale() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteScale(spriteGroup[g,k], x#, y#)
next k
endfunction
function SetSpriteGroupScaleByOffset(g, x#, y#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupScaleByOffset() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteScaleByOffset(spriteGroup[g,k], x#, y#)
next k
endfunction
function SetSpriteGroupScissor(g, x#, y#, x2#, y2#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupScissor() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteScissor(spriteGroup[g,k], x#, y#, x2#, y2#)
next k
endfunction
function SetSpriteGroupSize(g, w#, h#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupSize() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteSize(spriteGroup[g,k], w#, h#)
next k
endfunction
function SetSpriteGroupSnap(g, snap)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupSnap() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteSnap(spriteGroup[g,k], snap)
next k
endfunction
function SetSpriteGroupTransparency(g, mode)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupTransparency() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteTransparency(spriteGroup[g,k], mode)
next k
endfunction
function SetSpriteGroupUV(g, u1#, v1#, u2#, v2#, u3#, v3#, u4#, v4#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupUV() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteUV(spriteGroup[g,k], u1#, v1#, u2#, v2#, u3#, v3#, u4#, v4#)
next k
endfunction
function SetSpriteGroupUVBorder(g, b#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupUVBorder() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteUVBorder(spriteGroup[g,k], b#)
next k
endfunction
function SetSpriteGroupUVOffset(g, u#, v#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupUVOffset() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteUVOffset(spriteGroup[g,k], u#, v#)
next k
endfunction
function SetSpriteGroupUVScale(g, u#, v#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupUVScale() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteUVScale(spriteGroup[g,k], u#, v#)
next k
endfunction
function SetSpriteGroupVisible(g, state)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupVisible() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteVisible(spriteGroup[g,k], state)
next k
endfunction
function SetSpriteGroupX(g, x#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupX() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteX(spriteGroup[g,k], x#)
next k
endfunction
function SetSpriteGroupY(g, y#)
if g < 0 or g > spriteGroup.length
message("SetSpriteGroupY() called"+chr(13)+"with illegal group ID"): end
endif
for k = 0 to spriteGroup[g].length
SetSpriteY(spriteGroup[g,k], y#)
next k
endfunction
Either copy/paste that into your code or save it and
#include it (better option)
Use
mygroup = CreateSpriteGroup()
then add sprites to the group with:
SetSpriteToGroup( sprite, mygroup)
Then perform things on your group of sprites such as
SetSpriteGroupVisible(mygroup, state)
A sprite can be a member of multiple groups
You can remove a sprite from a group with
RemoveSpriteFromGroup(spriteID, groupID)
[Edit] I've attached the AGC file
AGK V2 user - Tier 1 (mostly)