Posted: 8th Nov 2022 13:02
I am trying to do a check to see what sprites loaded have a set GetSpriteColorAlpha set to 100 then add all of the total together, it is not going so well.
Here is my non working check.

I need a total value of the amount of sprites that are at the value.

then add that to a int.

+ Code Snippet
       for A=backgrounds.length  to 0 Step -1
	
	if GetRawKeyPressed(32)=1 then checkboard=1

	if checkboard=1 
	backgrounds[A].Colors=GetSpriteColorAlpha(backgrounds[A].ID)	
	if backgrounds[A].Colors=100
	inc CountGrid
	endif
	checkboard=0	
	endif
	
	next A
Posted: 8th Nov 2022 16:08
this might help (see CheckAlpha() ):

+ Code Snippet
// set display properties
SetVirtualResolution( 1280,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

GLOBAL Alpha100, MySprites as Integer []

MakeSprites()
ShuffleSprites()
CheckAlpha()

do 
	If GetRawKeyPressed(27) then End

	If GetPointerPressed()
		ShuffleSprites()
		CheckAlpha()
	EndIf

	Print("Click to Shuffle")
    Print( Alpha100 )
    Sync()
loop

Function CheckAlpha()
	Alpha100 = 0
	For x = 0 to MySprites.Length
		ThisAlpha = GetSpriteColorAlpha( MySprites[x] )
		If ThisAlpha = 100
			SetSpriteColor(MySprites[x], 255,0,0,ThisAlpha)
			INC Alpha100
		Else
			SetSpriteColor(MySprites[x], 255,255,255,ThisAlpha)
		EndIf 
	Next x
EndFunction


Function MakeSprites()
	for x = 1 to 50
		MySprites.Insert(CreateSprite(0))
	next x
EndFunction

Function ShuffleSprites()
	For x = 0 to MySprites.Length
		ThisSPR = MySprites[x]
		SetSpritePositionByOffset(ThisSPR, Random(100,1160), Random(100,620))
		SetSpriteColorAlpha(ThisSPR, 50 + Random(1,4)*50)
	Next x
EndFunction
Posted: 8th Nov 2022 19:49
Well that just saved my whole game lol, now I have a playable game.

You always help me. Thanks.