Jump to content
  • Advertisement
Sign in to follow this  

Libgdx TiledMapLayerTile issues

This topic is 1229 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...");
		System.out.println("Counted " + count + " tiles containing spawn key.");


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



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


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!