I keep getting an "subscript out of bounds" error when the "Standard_Enemy[0].Count" is equal to seven.
Setting up the arrays:
Type EnemyType
Image
BaseHealth As Integer
BaseAccuracy As Integer
BaseDamage As Integer
EndType
Dim Enemy[4,5] As EnemyType // [ tier , # ]
Type StandardEnemyType
Count As Integer
Sprite
Img As Integer
Health As Integer
Speed As Integer
Accuracy As Integer
Damage As Integer
EndType
Dim Standard_Enemy[0] As StandardEnemyType
The line triggering the error is marked:
Standard_Enemy[0].Count = Standard_Enemy[0].Count + 1
SP_ImgTemp = Random ( 1 , 5 )
Standard_Enemy[Standard_Enemy[0].Count].Sprite = CreateSprite ( Enemy[1,SP_ImgTemp].Image ) //////////////////////THIS ONE
SetSpriteSize ( Standard_Enemy[Standard_Enemy[0].Count].Sprite , GetImageWidth ( Enemy[1,SP_ImgTemp].Image ) , GetImageHeight ( Enemy[1,SP_ImgTemp].Image ) )
This is just a small portion of more code... I am sure that it works because for all values 1-6 my code works fine, it is when "Standard_Enemy[0].Count" is = 7 that the error is called. Pritty sure that this is a bug?
cheers