i'm starting to developt a android game using AndEngine gles2, it's a really good game engine and i found a lots of example of how use it. My game is a kind of RPG traditional game using tiled maps, sprite, etc.: my issue is how i can set a mounster respawn area(like the long grass areas on pokemon games) i read a lots of tile map example but in no one appears examples about this, i using a tiled map editor and there i can set properties to the layers and especify there if is a mounster respawn area or not, if can someone tell me how can i do this i will appreaciate so much.
Asked
Active
Viewed 774 times
1 Answers
0
Are you using the tilemapeditor found here:
(note, you need to save it with the correct compression type or otherwise andengine will not parse it correctly, cant remember which one I got working but it takes a few minutes to try out).
Then you can rightclick on a specific tile and add properties to it such as: IsMonsterSpawnArea value = true
Then you can check for "collision" with
if(pTMXTileProperties.containsTMXProperty("IsMonsterSpawnArea ", "true")) {
// SPAWN BIG UGLY MONSTER(or initiate fight!)
}
Check out the andengine TMX examples found in the andengine source, they can really help you get started.

Todilo
- 1,256
- 3
- 19
- 38
-
yes, i'm using that editor, my question is if exist a some kind of function in the tmx extension that generate a battle scene when the collision happens, if there no exist a function like those maybe someone have a example or orientation of how create the battle scene – dakairus Jul 19 '12 at 16:31
-
I am still not fully following you. Do you want a complete new map to load, why not just load on on collission with the specifik tile? – Todilo Jul 19 '12 at 21:51
-
that's my problem i don't know how set the collision with a tile where no exist a physical body, like rectangles or circles bodys from the 2d physics box, but that type of objects i don't know if can walk over them. – dakairus Jul 20 '12 at 03:20
-
Then I suggest you look at the TMX tile example in the andengine source. There you will find a collision test on each tile the player walks on, and it creates a rectangle below the player indicating the colliding tile. It is very simple once you see it. If you are still having problems I can post you some code in the evening. Dont have the source for my game with me. – Todilo Jul 20 '12 at 06:18
-
the problem is that how i can walk over the rectangles, in the tmx tile example i se how create de collision but when i create the respawn area it gets filled by rectangle object that don't let my walk over de rectangles, do you know how i can make that my character walk over the rectangles? – dakairus Jul 20 '12 at 15:37
-
if(group.getTMXObjectGroupProperties().containsTMXProperty("IsMonsterSpawnArea", "true")){ for(final TMXObject object : group.getTMXObjects()) { final Rectangle rect = new Rectangle(object.getX(), object.getY(),object.getWidth(), object.getHeight()); rect.setVisible(false); final FixtureDef boxFixtureDef = PhysicsFactory.createFixtureDef(0.0f, 0, 0f); PhysicsFactory.createBoxBody(this.mPhysicsWorld, rect, BodyType.StaticBody, boxFixtureDef); mScene.attachChild(rect); } – dakairus Jul 20 '12 at 16:14