Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 3:04 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jun 27, 2012 1:41 pm 
Offline

Joined: Mon May 07, 2012 11:36 pm
Posts: 93
Hi, i just tried using TiledMapPlus (using the latest dev branch of Slick). I had a for loop which get the object group count and the object count in that group and then prints the objectname for each object it finds. Using TiledMap worked fine with this, but TiledMapPlus doesn't seem to be able to read the name (it doesn't print the names of the objects).

Code:
public void objectList() {
   for (i = 0; i < map.getObjectGroupCount(); i++) {
      for (j = 0; j < map.getObjectCount(i); j++) {
         System.out.println("i: " + i + " name: " + map.getObjectName(i, j));
      }
   }
}

CONSOLE OUTPUT:
i: 0 name:
i: 0 name:
i: 0 name:
i: 0 name:
i: 0 name:
i: 0 name:
i: 0 name:


I didn't know if i should post this in the bug section or not, because i'm not sure if its an error i've made or if it is actually a bug.

Any help would be greatly appreciated.


Top
 Profile  
 
PostPosted: Tue Jul 03, 2012 9:21 am 
Offline

Joined: Mon May 07, 2012 11:36 pm
Posts: 93
No one got any idea's? Still unable to work out why this doesn't work on TiledMapPlus, but does on TiledMap :/


Top
 Profile  
 
PostPosted: Wed Jul 04, 2012 8:07 am 
Offline
Slick2D Developer

Joined: Thu Mar 31, 2011 5:06 am
Posts: 239
This is not the idiomatic way of doing things in TiledMapPlus. You want to use TiledMapPlus.getObjectGroup("name").getObjects() and iterate through this list. Note that this is not equivalent to getting all the objects, only the ones in the specified group "name".

_________________
Liam (liamzebedee) Edwards-Playne
Cryptum


Top
 Profile  
 
PostPosted: Wed Jul 04, 2012 2:58 pm 
Offline

Joined: Mon May 07, 2012 11:36 pm
Posts: 93
Ah ok. Thanks for letting me know! I'll give it a try! Thanks again :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group