Problem displaying a level


(Pedro Torcatt) #1

Hello everybody, it’s a pleasure to participate in the community, I have a problem when showing a map made with OGMO 2 version, because I have too many problems to install version 3, my system is 32 bits and when I try to compile a new version I get errors, anyway, following Zachary Lewis’ tutorial, everything runs but it shows me this:

2020-06-09%2011_40_43-Adobe%20Flash%20Player%2010

This is the level code (Level.as):

package 
{
	import flash.utils.ByteArray;
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Tilemap;
	import net.flashpunk.masks.Grid;
	import net.flashpunk.FP;
	
	public class Level extends Entity 
	{
		private var _tiles:Tilemap;
		private var _grid:Grid;
		public function Level(xml:Class) 
		{
			_tiles = new Tilemap(Assets.ARENA, 640, 480, 32, 32);
			graphic = _tiles;
			layer = 1;
			
			_grid = new Grid(640, 480, 32, 32, 0, 0);
			mask = _grid;
			type = "level";
			loadLevel(xml);
		}
		
		private function loadLevel(xml:Class):void
		{
			var rawData:ByteArray = new xml;
			var dataString:String = rawData.readUTFBytes(rawData.length);
			var xmlData:XML = new XML(dataString);
			
			var dataList:XMLList;
			var dataElement:XML;
			
			dataList = xmlData.Piso.tile;
			for each(dataElement in dataList){
				_tiles.setTile(int(dataElement.@x) / 32, int(dataElement.@y) / 32, int(dataElement.@tx) / 32);
			}
		}
	}
}

Assets.as code

package  
{
	public class Assets 
	{	
		// Tilesets
		[Embed(source="../assets/World/Arena_Tileset.png")] public static const ARENA:Class;
	}
}

In the tutorial the XML structure generated by OGMO 0.915 is different from version 2, I don’t know if it has anything to do with it. The map also has several layers, and the “Piso” layer

dataList = xmlData.Piso.tile;

is supposed to be only sand, that is, that structure shown on the top left should not even be shown there. Thanks in advance.