Character Movement

  ... discussions about development with the GLES1 branch of AndEngine.

Character Movement

Postby Siddharth » Tue Dec 25, 2012 7:30 pm

I want to develop a game that is similar to the following game.

https://play.google.com/store/apps/deta ... GFyemFuIl0.

I was confused about how to develop character like tarzan. I have some what enough experience with andengine. How to perform movement of the character. I some question about this type game.

1) I have to use box2d or not?
2) I have to create single body body for the character of multiple? and how implementation done using single body?
3) How to perform different action on the character?

Only basic concept become enough for me. Thanks for you support.
User avatar
Siddharth
 
Posts: 275
Joined: Thu May 03, 2012 12:11 pm
Location: Rajkot

Re: Character Movement

Postby ViktorS » Wed Dec 26, 2012 2:40 am

I didn't really play the game, but from screenshots - it's a simple platformer. So:
1) Box2d - yes, I would definetly recommend using it.
2) Simple(one fixture) single body for character. Simple single bodies for enemies. Single complex(multi-fixture) body for ground. Character and enemy bodies are dynamic ground is static. Character and enemy bodies should be set to fixed rotation, so they don't turn. For more controll over character movement I suggest setting linear damping to 0. Not necessary, but easier to calculate jumps and such.
3) Set(or Apply) linear velocity. To move or jump. Linear velocity is set by 2 values x and y. For simple movement set x to predefined value and 0 y, for jumps set both to some value. Also I found it easier to change friction to 0 when moving and then change it to 100(or any other suitable value) when stopping. This makes it harder to manage, but again, easier to calculate precise movement.

P.S. making single-fixture single body for character and enemies is easier, but not always the best decision, if you find the behaviour not suitable try reading on some peoples sugestions for better multi-fixture bodies. I personaly like the idea of capsule like body it is guaranteed not to get stuck on edges.(Especially with friction set to 0)

Enjoy
'Javelin OU' presents, my latest game - Joj the alien
ViktorS
 
Posts: 580
Joined: Thu Oct 27, 2011 2:18 pm

Re: Character Movement

Postby Siddharth » Wed Dec 26, 2012 5:52 pm

ViktorS wrote:I didn't really play the game, but from screenshots - it's a simple platformer.


Thanks for your reply.
I like you suggestion of creating capsule like body rather than simple box body.
But again I want to ask that if I create capsule body then how can it stand on its position. I may fall down on the ground. So how to control that situation by coding.

If the ground body is in elliptical shape rather than flat surface, then how to move object on this type of ground.
Then how to calculate for x and y velocity.
User avatar
Siddharth
 
Posts: 275
Joined: Thu May 03, 2012 12:11 pm
Location: Rajkot

Re: Character Movement

Postby ViktorS » Wed Dec 26, 2012 6:19 pm

I like you suggestion of creating capsule like body rather than simple box body.
But again I want to ask that if I create capsule body then how can it stand on its position. I may fall down on the ground. So how to control that situation by coding.


That is exactly why I said to set fixed rotation. It allows body not to turn under any kind of force. So it cannot fall flat down. as it will always have rotation 0.

If the ground body is in elliptical shape rather than flat surface, then how to move object on this type of ground.
Then how to calculate for x and y velocity.


That depends. If by eliptical shape you mean simple curve then giving it X linear velocity while y is 0 or better yet the same as it had before. Then it will move just fine the gravity will do the rest. But if you mean that the hero must be able to travel full circle around some object with its legs sticking to the object. I would recommend using revolute joints.

Enjoy.
'Javelin OU' presents, my latest game - Joj the alien
ViktorS
 
Posts: 580
Joined: Thu Oct 27, 2011 2:18 pm


Return to GLES1

Who is online

Users browsing this forum: Google Feedfetcher and 13 guests