Created
June 30, 2009 05:45
-
-
Save fabjan/138020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element groundLayer = getLayer(mapDocument, "ground"); | |
int groundOffset = getFirstGID(mapDocument, "ground"); | |
int[] groundGIDs = getGIDs(groundLayer); | |
for (int i = 0; i < groundGIDs.length; i++) { | |
int id = groundGIDs[i]; | |
if (id > 0) { | |
map.setTile(i % mapWidth, i / mapWidth, | |
(Image) tiles.get(id - groundOffset)); | |
} | |
} | |
Element powerupLayer = getLayer(mapDocument, "powerups"); | |
int powerupOffset = getFirstGID(mapDocument, "powerups"); | |
int[] powerupGIDs = getGIDs(powerupLayer); | |
for (int i = 0; i < powerupGIDs.length; i++) { | |
int id = powerupGIDs[i]; | |
if (id > 0) { | |
addSprite(map, powerups[id - powerupOffset], | |
i % mapWidth, i / mapWidth); | |
} | |
} | |
Element mobLayer = getLayer(mapDocument, "mobs"); | |
int mobOffset = getFirstGID(mapDocument, "mobs"); | |
int[] mobGIDs = getGIDs(mobLayer); | |
for (int i = 0; i < mobGIDs.length; i++) { | |
int id = mobGIDs[i]; | |
if (id > 0) { | |
addSprite(map, mobs[id - mobOffset], | |
i % mapWidth, i / mapWidth); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment