The best approach is to have a bunch of simple test projects (like the ones Nomad posts) and learn something new in each small project, keep it targeted, after a while you have a bunch of projects full of working code you can call upon.
You could be forgiven for getting confused over arrays, as far as AppGameKit goes its about the most complex thing in there, I learned arrays in Lua and oh boy when I first started it blew my mind, more recently with C++ HashLists and Vector arrays ... still not quite there on those yet.
Bear in mind you are not setting the array x,y (is this test code?)
Function SpawnCoin(Spr)
All_Coins as CoinType
All_Coins.ID = CreateSprite(coins_1)
x = GetSpriteXByOffset(Spr) : y = GetSpriteY(Spr)
SetSpritePositionByOffset(All_Coins.ID, x,y-5)
SetSpriteGroup(All_Coins.ID,-10)
SetSpritePhysicsOn(All_Coins.ID ,2)
SetSpriteShapeCircle(All_Coins.ID,0,0,8)
SetSpritePhysicsVelocity(All_Coins.ID ,0,-10.0)
SetSpriteSize(All_Coins.ID,5,5)
SetSpriteAnimation(All_Coins.ID ,128,128,6)
PlaySprite(All_Coins.ID,10, 1, 1, 6)
All_Coins.Timers =1
CollectedCoins .InsertSorted(All_Coins )
EndFunction
add in there
All_Coins .x=x
All_Coins .y=y
Quote: "But when I did it makes a unlimited amount then my app crashes."
LOL, yeah, does your PC have unlimited memory? (or am I misunderstood, again)
As Nomad pointed out you are declaring the array with 1 item
GLOBAL CollectedCoins as CoinType[0]
and then using insert, if you run a loop on this array and index the ID field of item 1(0) without first checking for a valid ID (GetSpriteExists) then it will error out with a invalid sprite id (always minus 1 remember that, its called zero based indexing)
Could this be what was causing your error?