Another OGMO question!


(Nate ) #1

Hey guys! So I am trying to get my grid tiled that I created with OGMO. I have added tiles for the walls and water.

Starting with just the walls and going off of Zach’s tutorial, I am getting two errors that I have never seen before:

  1. col: 3: Error: unable to resolve ‘…/assets/wall.png’ for transcoding

  2. col: 3: Error: Unable to transcode …/assets/wall.png.

This is the code from my world.as

// Add code for the tilesheet.
		if (String(mapXML.Wall).length > 0)
		{
			var tm:Tilemap = new Tilemap(assets.TILESHEET, _mapGrid.width, _mapGrid.height, 40, 40);
			tm.loadFromString(mapXML.Wall, ",", "\n");

			// Save the tilemap as the map image.
			_mapImage = tm;
			
			trace("added the tilemap");
		}

This is the code from my assets class:

		[Embed(source = "../assets/wall.png")] public static const TILESHEET:Class;

I did it exactly like Zach did in his tutorial so I am not sure what the issue is, it looks like the issues lies within the assets class but I am not sure what it might be.


(Zachary Lewis) #2

It sounds like you don’t have your assets in the correct location.

Your setup should look something like this:

+ Project
  + src
  | - Main.as
  | - Map.as
  + assets
  | - wall.png

(Nate ) #3

Okay my setup was okay, I just didn’t need the …/ before assets. I now have a massive wall of blocks… not sure what would be causing this now… do I have to create tm as a Tilemap?

Okay it appears as the tiles were added, however, they are covering the entire stage. This is the code I used:

	// Add code for the tilesheet.
		if (String(mapXML.Wall).length > 0)
		{
			var tm:Tilemap = new Tilemap(assets.TILESHEET, _mapGrid.width, _mapGrid.height, 40, 40);
			tm.loadFromString(mapXML.Wall, ",", "\n");

			// Save the tilemap as the map image.
			_mapImage = tm;
			
			trace("added the tilemap");
		}

(Nate ) #4

Also I have been trying for the last like 2 hours to access your tiles video and it will not load for the life of me, I have tried four different computers and like six different browsers haha it seems to be just that video lol D: that feel


(Nate ) #5

This is what my game looks like with the above code:

As you can see the block tile is covering everything, however my character is still able to move around and collide with the grid, which can be seen when I hit the tilde key and access the console.


(Nate ) #6

Hey guys! Still no luck!

I just followed this tutorial:

http://blog.pixelsquidgames.net/2012/08/loading-ogmo2-levels-in-flashpunk/

and am getting the same exact result, blocks everywhere, that should only be where my grid is D:


(Nate ) #7

Maybe I am doing something wrong with OGMO? Here is my map in OGMO, I have messed around with the layer hierarchy and that gives me the same result when I compile.

Here is the .oel and my level.as code that accesses it:

Thanks guys!


(Nate ) #8

This post was flagged by the community and is temporarily hidden.


(Blake Jones) #9

Well I stumbled on a clue towards maybe fixing this. I had the same problem as you.

For some reason in the .oel file all the “-1” values are being identified as spaces where a tile should go instead of being a proper blank space.

If you put nothing between the commas it works just fine. But this would require someone to literally erase all the "-1"s and leave thousands of commas to describe each cell. Ill report back if i figure out how to fix it.


(Nate ) #10

Do you mean nothing between the quotes? hm… this sounds like a huge brutal issue… is there a reason that I am getting the negative ones? I did notice a strong lack of negative ones in all of the examples I looked at D:


(Blake Jones) #11

I looked in the source files for Zach’s tutorial and he exported the tile layer as “trimmed CSV” instead of the default CSV. Now this exports a file that has no -1s, but it also has no commas separating each cell soooo it just provides a new problem. Tell me if it works for you to save your tile layer as trimimed csv instead


(Nate ) #12

I have mine exported as a trimmed CSV, I did sort of a combination of the two tutorials, Zach’s first then Alex’s


(Blake Jones) #13

Same here buddy. We’re fighting the same beast.


(Nate ) #14

Oh man, well let me know if you have any break throughs! Zach z0mG halp :dancers:


(Blake Jones) #15

Hum while I summon @zachwlewis


(Nate ) #16

omg well you are correct… I deleted some of the -1’s and my sky showed through D: I opened the .oel and hit ctrl + f and typed in -1 so I have all the negative ones selected, is there a slick macro or keystroke that I can press to replace them all with nothing?


(Blake Jones) #17

I remember from a programming class that there’s a way to delete all those -1s using the command prompt but hell if I remember. I’m gonna try to just copy it into microsoft word and use the word replacer thing to delete all the -1s…


(Nate ) #18

I am thinking, we can probably write a slick for loop to change all the -1’s in the tileset of the xml to " "


(Nate ) #19

This is my pseudocode, it doesn’t work yet but something like this?

//change the -1 to “”

		var list:XMLList;
		var element:XML;
		list = xml.tiles_layer1;
		for each (element in list)
		{
			if ( element == -1)
			{
				element = "";
			}
		}

(Nate ) #20

I got it man!

Download this plugin!

https://code.google.com/p/findandreplaceex/downloads/detail?name=FindReplaceEx.zip&can=1&q=

Highlight the string of -1’s then press ctrl + H

Then tell it to find all the -1’s in the current selection, and for the replace with, just click into it and do not do anything, do not hit spacebar there or it will give you " " instead of “”

Hope this helps! It worked for me :smiley: