Removed
FIXED IT!
Moved to: http://www.java-gaming.org/topics/reducing-class-file-sizes-java4k/29004/view.html
Solution:
Removed
FIXED IT!
Moved to: http://www.java-gaming.org/topics/reducing-class-file-sizes-java4k/29004/view.html
Solution:
I just took a quick look and in the shrunk version you overwrite bS, fS, pS all the time and in the other version you have separate objects for boxDef, groundDef etc. Perhaps that has something to do with it?
On a sidenote: Is the shrunk version only shorter variable names? In that case I think you should ditch the shrunken version. Why would you want to change your code to something that´s much harder to read?
I read on the Box2D forums, that the *Def can be reused. But maybe i did something wrong somewhere… :s
It makes the final Class file smaller
I’m secretly practicing for Java4K!
EDIT: PolygonShape has a .clone() so thats not the problem, as I clone it before I reuse it.
EDIT2: On the other hand, maybe reusing variables only work in the C/C++ version
Oh. I guess that´s what happens when you just take “a quick look”. Sorry about that.
Just to clarify: “right” and “left” works fine, it´s just “up” that´s causing a problem?
Yes, right and left works fine. But not up or the walls
Could it be that you changed the float here…
[icode]box.setLinearVelocity(new Vec2(0, 7.5f));[/icode]
to an integer here…
[icode] b.setLinearVelocity(new Vec2(0, 8));[/icode]
Just guessing, I dunno. Everything else looks like it copied exactly…
I found the problem
I was using:
float step = 1 / 60f;
// While and sutff here ----
World.step(step, 8, 1);
But this did not work as it should
Fix:
World.step(1/60f, 8, 1);
This works!
It maybe not wise to remove the first post, someone might found it useful.