Platform game - Three issues

Hi Guys,

This forum is great and it has helped me several times to read the posts here.

Now to me issues with a platformer.

1: I have implemented graphics using Actor, and everything is fine until I comment the standard debug draw. Then, everything becomes laggy. I've looked around the forum and I've seen that other have had the same problem, but I haven't solved it. Any ideas?

2: I've been using this techique when creating the terrain: http://www.box2d.org/forum/viewtopic.php?f=8&t=1437&hilit=terrain . But when I make the character jump, it doesn't jump straight up (as I want it to), it jumps forward if the character is standing on sloping terrain. This is my "jump-code":

Code:
characterBody.ApplyImpulse(new b2Vec2(0,35),  characterBody.GetWorldCenter())


3: How can I apply a constant force if I want the character moving forward? For the moment it slows down after a while:

Code:
characterBody.ApplyImpulse(new b2Vec2(1,0),  characterBody.GetWorldCenter())


Thanks in advance! 🙂
1) Not sure we ever cracked this, but it's a flash framerate issue. I.e. basically voodoo magic as far as I'm concerned.

2) That code should make a character jump straight up. You sure some other code isn't interfering with the jump, e.g. you walking about code. You might want to try SetLinearVelocity, as that will force there to be no horizontal motion.

3) You are applying a constant force, if you call the line you've shown every frame (and the framerate is constant).
1) Can you link some relevant posts and maybe your SWF with and without debug draw?

2) You're applying an impulse in the wrong direction (down), and your "jump" is the player bouncing off your terrain.
Thank you for the reply! 🙂

BorisTheBrave wrote:
1) Not sure we ever cracked this, but it's a flash framerate issue. I.e. basically voodoo magic as far as I'm concerned.


Is there any way for me to fool the system? By having Debug Draw on, but not showing it?
chriswa wrote:
1) Can you link some relevant posts and maybe your SWF with and without debug draw?

2) You're applying an impulse in the wrong direction (down), and your "jump" is the player bouncing off your terrain.



I will post the SWFs tomorrow. I've tried everything I can think of... :/

Thanks for the correction at my second point (I feel stupid 🙂 )
chriswa wrote:
2) You're applying an impulse in the wrong direction (down), and your "jump" is the player bouncing off your terrain.

Oh, yes. Well spotted chriswa, I really need to stop responding so close to bed time.
zebulon wrote:
having Debug Draw on, but not showing it?
.alpha = 0?
Quote:
.alpha = 0?


I hope there's a better solution than this!

Original thread: https://box2d.org/forum/viewtopic.php?t=1848