View Single Post
  #38 (permalink)  
Old 07-06-2009, 09:02 AM
agraham's Avatar
agraham agraham is online now
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by enonod View Post
The second Dim gives the error that SpriteData is already in the dictionary.
I can't see anything wrong with that code. The only way I think you can get that error is if two Dim statements for the same array are in Sub Globals, only the Type statement must be in there. If it persists you will need to post some code that shows the error so I can see the context. Look at the DataDemo.sbp in the archive which contains that same code.

Quote:
I tried Dim Type(x,y)SpriteData(4) which is OK
Actually it's not. That makes SpriteData into a two dimensional array hence the comma in "String[,]" in the error message. The library expects a single dimension array, hence the error.

EDIT:- The occurrence of the "cannot be converted error" implies that the "Dim SpriteData(4)" statement is not being executed before "Sprite.DataArray = Spritedata()" as that converts it back to a one dimension array. Looks like the execution sequence is wrong. Each Sprite needs its own array. If you don't re-Dim it for each Sprite they will share the same array - which you might or might not want to do, most likely not!
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 07-06-2009 at 09:14 AM.
Reply With Quote