Quote: "Also, do you do an initial Dim for UnitWaypoint in your main.agc file before you do whatever it is that gets you to this point?"
I did not, and that seems to have been the problem
Thanks for the help!
It's weird though since I have declared arrays outside the main.agc file before and it has worked before.
I do have another weird problem thoug. When I start the game, the player shuld chose wich vehicle to use, So I load the 2 images and sprites and just place them in the center of the screen using this function
Function GUICreateStaticButtonBox (File$, Scale#, X#, Y#)
//Loading the image for the Button
IMG = LoadImage (File$)
//Creating the sprite and setting it's parameters
Number = CreateSprite(IMG)
SetSpriteScale(Number, Scale#, Scale#)
SetSpritePositionByOffset (Number, X#, Y#)
SetSpriteDepth(Number, 1)
SetSpriteShape(Number, 1)
EndFunction (Number)
Print ("Loading cobra")
Sync()
MainMedia[20] = GUICreateStaticButton ("CobraRotor.png", 0.016, 40, 50)
SetSpriteAnimation(MainMedia[20], 512, 512, 5)
//Debug
Print ("Loading Littlebird")
Sync()
MainMedia[21] = GUICreateStaticButton ("littlebird.png", 0.016, 60, 50)
SetSpriteAnimation(MainMedia[21], 512, 512, 5)
//Debug
Print ("LoadingBackground")
Sync()
When doing this it takes about 1 second per sprite on windows and 2 seconds on android And only these two sprites.
When i load the same images and allmost do the same thing in the game, the images are loaded without any delay at all
This is how I do it ingame
Player.ID = CreateSprite (HeliIMG)
SetSpriteScale (player.ID, 0.012, 0.012)
SetSpriteAnimation(Player.ID, 512, 512, Player.AnimationFrames)
PlaySprite(PLayer.ID, 20)
SetSpritePositionByOffset(Player.ID, 50, 50)
SetSpriteDepth (Player.ID, 5)
Edit
About the 50000 sprites. I don't use 50k sprites but since agk starts creating ID's at 10k I figured 50k would be a fitting sum
And since it dosn't seem to create any lag or anything it hasn't botherd me...