Skip to content Skip to sidebar Skip to footer

How To Use Tmx Map Object Property To Change Objects Behaviour

i am developing game in andEngine using Tiled maps in TMX map i have river object and i want player will be die after falling in river but i have no idea how to implement this I a

Solution 1:

Use the same code. In your TMX editor, create a new layer and add a property "danger" to it. You can then create any objects there (e.g. rectangles over your river tiles). Then add another if:

...
else if(group.getTMXObjectGroupProperties().containsTMXProperty("danger", "true"))
{
    // This is layer with dangerous objects (river etc)
    for(final TMXObject object : group.getTMXObjects()) 
    {
        // create sensor physics body and register collision detection
        // on collision, make the user die
    }
}

Post a Comment for "How To Use Tmx Map Object Property To Change Objects Behaviour"