Tag Info

New answers tagged

2

Try this: var speed = Math.sqrt(Math.pow(heroVelX, 2) + Math.pow(heroVelY, 2)); The case is that the ^ operator is the bitwise XOR operator. You should use Math.pow(base, exponent). Here is a an example: link.


0

I've already got a pretty reasonable answer to this over here, with some video examples. The short version is: You cannot reasonably use rigid body physics to simulate biped locomotion in the kind of responsive way you'd want for a platformer. You have to do something else.


1

LET THIS BE A CAUTIONARY TALE ABOUT BOX2D! Haha! Here's the solution I came up with The problem I amrunning into is due to the fact that Box2D uses meters instead of pixels for the scale, in my game a screen that is 1920x1080 would be 1920 meters wide and if I am using sprites a small sprite will be only as many meters wide as it is in pixels. The reason ...


0

According to libgdx's Box2D introduction, "The Box2D implementation in libgdx is a thin Java wrapper about the C++ engine", which would be in World.java in the libgdx sources, but it's not. So: No, there isn't. …yet! You could ask nicely in the libgdx issue tracker. (Or maybe implement it yourself and send a pull request if you know C++ Box2D? I'm ...


0

I solved it adding the ParticleEffect to he body and before rendering the effect in render function: public Body createThrowedBall(float x, float y) { Gdx.app.log("createThrowedBall", "("+x+","+y+")"); BodyDef ballDef = new BodyDef(); ballDef.type = BodyType.DynamicBody; ballDef.position.set(x,y); CircleShape shape = new ...


0

Why dont you apply force during the render thread. You can set a boolean value start and stop the tilt, since its under the render thread it will probably stay tilted since that same force is being applied constantly


0

A thought. Have the player have their own world that's synched with the server world, then check for out of sync by using a special sync object with positional values (compare them every so often).


0

conceptually, you would split off the main body sprite, and the rotating arm sprite. then you use the same transformations on the arm as you do on the main body. when you want the arm to rotate you set the arm sprite's origin point to the shoulder of the body sprite and rotate around that. once your characters arm reaches an unrealistic angle, simply flip ...



Top 50 recent answers are included