Hello,
I hope I can phrase this question properly. First, some XML for reference:
In "pkg:/assets/sprite.map.xml":
<DefenderBitmapSet>
<Bitmap name="gameTiles" filespec="pkg:/assets/tiles.png">
<Region name="selectedTile" x="00" y="00" w="32" h="32"/>
<Region name="defaultTile" x="32" y="00" w="32" h="32"/>
</Bitmap>
</DefenderBitmapSet>
And the main brs code:
Library "v30/bslDefender.brs"
Function Main ()
app = { }
app.tiles = GetGameTiles()
Print app.tiles.bitmapset.regions
End Function
Function GetGameTiles () As Object
tiles = { }
tiles.bitmapset = dfNewBitmapSet(ReadAsciiFile("pkg:/assets/sprite.map.xml"))
Return tiles
End Function
Running the code, everything seems fine so far:
Output:
------ Running ------
dfNewBitmapSet: no <Background> tag in BitmapSet
gameTiles: <Component: roRegion>
gameTiles.defaultTile: <Component: roRegion>
gameTiles.selectedTile: <Component: roRegion>
But when I try to access the region with...
Print app.tiles.bitmapset.regions.gameTiles.defaultTile
I get an error thrown...
Output:
Current Function:
003: Function Main ()
004:
005: app = { }
006: app.tiles = GetGameTiles()
007:
008: Print app.tiles.bitmapset.regions.gameTiles.defaultTile
009:
010: End Function
Syntax Error. (runtime error &h02) in ...rpANq/pkg:/source/appMain.brs(8)
008: Print app.tiles.bitmapset.regions.gameTiles.defaultTile
Backtrace:
Function main() As
file/line: /tmp/plugin/BBBA...rpANq/pkg:/source/appMain.brs(8)
Local Variables:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=2
app &h0010 bsc:roAssociativeArray, refcnt=1
Shouldn't I be getting an roRegion traced? I've use the XML file with animation tags successfully before, so I assumed I could just use a single bitmap and use the regions with the NewSprite command instead of NewAnimatedSprite. Is that not possible? Do I need to have a separate bitmap tag for each?
I'm putting together a development tutorial, so any help appreciated. Thanks in advance.
-dev