Woohoo, so I was able to figure this out without breaking anything, even if Hughbus' code is still out of my league.
function createMap( currentMap as tileMapType, tileset as tilesetType, scale# )
currentMap.scaleFactor = scale#
//using step commands to work from the bottom layer upwards (saves setting sort values)
for layer = currentMap.layers.length to 0 step -1
//index is used to increment which tile we are up to within any given layer
index = 0
for y = 1 to currentMap.tileshigh
for x = 1 to currentMap.tileswide
//If Pyxel has stored a sprite for the selected area, continue.
If currentMap.layers[layer].tiles[index].tile > -1
//Create Sprite and set position/orientation
newTile = createSprite( tileset.ID )
SetSpriteScale( newTile, scale#, scale# )
setSpritePosition( newTile, (x - 1) * currentMap.tilewidth * scale#, (y - 1) * currentMap.tileheight * scale# )
setSpriteAngle( newTile, currentMap.layers[layer].tiles[index].rot * 90 )
if currentMap.layers[layer].tiles[index].tile > 1 then setspritephysicson(newTile, 1) // I ADDED THIS LINE FOR PHYSICS
//If the tile is marked as flipped, flip it
if currentMap.layers[layer].tiles[index].flipX = "true"
setSpriteFlip( newTile, 1, 0 )
endif
//set the sprite image using the tileset as animation frames
SetSpriteAnimation( newTile, currentMap.tilewidth, currentMap.tileheight, tileset.frames )
SetSpriteFrame( newTile, currentMap.layers[layer].tiles[index].tile + 1 )
SetSpriteDepth( newTile, (layer * 10) + 10 )
//Give the sprite an ID
currentMap.layers[layer].tiles[index].ID = newTile
endif
index = index + 1
next x
next y
next layer
endfunction currentMap
One smart fellow, he felt smart. Two smart fellows, both felt smart. Three smart fellows all felt smart...