Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am using AndEngine to create a 2d Game for Android platform using ecliplse java.

I have learned how to use Tiled to create tiled maps. The only problem i am having is that i dont know how to place an object such as a character on the ground, and have it count as the ground.

How do i go about doing this or what is the best way to do this?

share|improve this question
Do you mean your game is a side-scroller and you want some tiles to be "empty" so the character falls down, and some other tiles to be "solid" so the character can walk on them? – Sergey Nov 3 '11 at 5:35
Yes this is exactly what i want – Troy Walker Nov 8 '11 at 3:35

1 Answer

AndEngine examples have a TMX Map Example which, among other things, demonstrates how to place a character on the map and how to determine in which map cell the character is currently in.

From there it should be simple(-ish) - you need to designate some map tiles as "empty" and some as "solid" - TMX format allows you to specify properties of tiles so I guess that's what I would use. Then you write a function which checks if your character is in "mid-air", an if so, the character should begin falling. In pseudocode:

if (map.isEmptySpace(character.getX(), character.getY()) {
   character.setVSpeed(character.getVSpeed() + GRAVITY);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.