Posted: 26th Aug 2011 19:57
Will these be supported or do we need to use the File commands with arrays?

Example: I want to build a level map that determines what image to use where. In DBPro we can use Read and Data statements, but that doesn't appear to be an option here.

Thanks
JHA
Posted: 26th Aug 2011 23:17
You need to use file commands.
Posted: 26th Aug 2011 23:29
You could get tricksy and instead of a bunch of data statements, use a bunch of assignment statements.

+ Code Snippet
m[1] = "1111111111"
m[2] = "1000000001"
m[3] = "1000011111"


and so on. m[x] is the same length to type as DATA, until you reach x > 9.
Posted: 26th Aug 2011 23:47
Thanks Guys! I like that approach Rich. I may use it.

JHA
Posted: 27th Aug 2011 20:07
Unfortunately you have to use strings as people have suggested. I much prefer the simple data commands for internal work however, and hope they will be added in future updates.
Posted: 28th Aug 2011 7:22
use vectors I did a 3d vector solver that used 0's and 1's to represent a maze in 3d. So this should not be any different.
Posted: 1st Sep 2011 20:37
Hello All,

Thanks for the feedback! Although I do prefer the Read/Data/Restore method, Rich's method above is working perfectly.

See the code below for a simple but working method:

+ Code Snippet
level1:
    m$[0] =  "11111111111111111111111111111111"
    m$[1] =  "10000000000000111000000000000001"
    m$[2] =  "10000000000000010000000000000001"
    m$[3] =  "10000001000000000000000010000001"
    m$[4] =  "10000011100000000000000111000001"
    m$[5] =  "10000001000000000000000010000001"
    m$[6] =  "10000000000000000000000000000001"
    m$[7] =  "10000000000000000000000000000001"
    m$[8] =  "10000000000000000000000000000001"
    m$[9] =  "10000000000000010000000000000001"
    m$[10] = "10001100000000111000000000011001"
    m$[11] = "10000110000001111100000000110001"
    m$[12] = "10000110000000111000000000110001"
    m$[13] = "10001100000000010000000000011001"
    m$[14] = "10000000000000000000000000000001"
    m$[15] = "10000000000000000000000000000001"
    m$[16] = "10000000000000000000000000000001"
    m$[17] = "10000000000000000000000000000001"
    m$[18] = "10000001000000000000000010000001"
    m$[19] = "10000011100000000000000111000001"
    m$[20] = "10000001000000000000000010000001"
    m$[21] = "10000000000000010000000000000001"
    m$[22] = "10000000000000111000000000000001"
    m$[23] = "11111111111111111111111111111111"
Return

create_level:

    wx = 0: wy = 0: loc = 0: wSpr = 999
    for row = 0 to 23
        for seg = 0 to 31
            if mid(m$[loc], seg, 1) = "1"
                inc wSpr
                CreateSprite(wSpr, walls)
                SetSpritePosition(wSpr, wx, wy)
                SetSpriteDepth(wSpr, 10)
            endif
            inc wx, 32
        next seg
        inc loc
        inc wy, 32
        wx = 0
    next row

Return


This is for a single Wall image at 32x32, but it can be expanded to add different images for doors, items, etc...

The SetSpriteDepth command can be used for moving sprites above and below other sprites too, so I'm loving AppGameKit so far!!

Thanks again!!

JHA
Posted: 2nd Sep 2011 5:19
We thought about retaining DATA, READ and RESTORE but they are very legacy these days, and the modern way of thinking puts data nice and separate in a file or in the cloud somewhere. We did add something to make life a little easier though, you can do this:

dim mydata$[10] as string = [ "a", "b", "c" ]

Perhaps not as elegant as mixed type data statements, but a cool way to group together data items and associate them with an array structure in a single line