Libgdx TiledMapLayerTile issues

Started by
0 comments, last by Clobslee 8 years, 8 months ago

Why would this code be acting odd? Any string I hand the .containsKey() function returns true. So every tile on my layer is trying to spawn a mob, and it's causing some issues haha. I'm using the same function to check for "solid" in another class and that one works as excpected.


                String key = "spawn";
                System.out.println("Spawning mobs into memory...");
		int count = 0;
		int toSpawnCount = 0;
		System.out.println("Current Floor: " + player.getCurrentFloor() );
		System.out.println("FloorSize: " + levels[player.getCurrentFloor()].getWidth() + ", " +  levels[player.getCurrentFloor()].getHeight());
		
		for (int x = 0; x < levels[player.getCurrentFloor()].getWidth(); x++)
			for (int y = 0; y < levels[player.getCurrentFloor()].getHeight(); y++)
			{
				if (tiles.getCell(x, y) != null)
					if (tiles.getCell(x, y).getTile().getProperties().containsKey(key));
					{
					//	System.out.println("Found a tile to spawn...");
						alist.add(x);
						alist.add(y);
						count++;
					}	
				//count++;
			}
	
		System.out.println("Counted " + count + " tiles containing spawn key.");

Output


Spawning mobs into memory...
Current Floor: 0
FloorSize: 25, 25
Counted 625 tiles containing spawn key.

[attachment=28400:mapSpawn.png]

The "mud" tiles contain the "spawn" key, and no other tiles do. I've double and triple checked!

Advertisement

Found the error! Was syntax, and I found it right after posting this as I always do.

This topic is closed to new replies.

Advertisement