Hot answers tagged

9

I tried this. It was hard, but I did it. Left is GIMP, top-right is a Box2D debug renderer, bottom-right is a build shell Code repository for reference The full code is on github here. It's scattered in a whole lot of files, so it's a bit big to put here. See below for an explanation of the technique. How? I used ImageMagick, Potrace, Node.js ...


3

R.U.B.E. does this. The feature was included with the addition of samplers since v1.6.0. This tutorial video gives a description of how it can be done. To test, I used Anko's and Xander's images for comparison. First I imported the image of the sword and heart wand into RUBE (I'm on v1.7.0) and created some samplers (shown by dashed outlines) over them. ...


3

Have you considered playing the sound when the direction of the ball changes? Or like add that as a condition, in addition to the already "collide with object" condition.


3

I don't think you can fix that "loading" issue, if your game has to open a file from HDD, load the content, parse it and draw it there's nothing to do that could speed it up. I would say that, the best you can do is store the whole map in memory and get chunks more often, like 100m sou you should be able to high speed reading from ram and the lag would ...


2

You can find all what you need here Tile maps class, and read the section Rendering Tiled Maps according to Libgdx docs: Performance considerations While we try to make the renderers as fast as possible, there are a few things you can consider to boost rendering performance. Only use tiles from a single tile set in a layer. This will reduce ...


2

If I understand the problem correctly, you were close to properly solving it. Your approach with the normals is what you want, but instead of only saving the normal of the last collision, save a list of normals from all current collisions/overlappings. Then, play the sound whenever the new normal of the new collision is not yet present in the list. In ...


2

Summary My recommendation is to compute a restorative torque to apply to the object. This is physically more accurate than setting the velocity directly, and the simulation will be better behaved. This solution should also work for any launch angle. Below is a gif of this method at work stabilizing arrows launched from a car. Restorative Torque This ...


1

You can call the createBalls at some interval from your game loop, and possibly pass in how many balls you want it to create. For example; public class YourGame extends Game { private long lastTime; @Override public void create() { } @Override public void render() { if (TimeUtils.nanoTime() - lastTime; > ...


1

I reccomend you delete and load smaller pieces (~50m) at a time to keep a more stable (if not lower) fps.


1

Ok, I'm piggy-backing on Skitskraj's answer here so if you like mine, upvote his/hers too. Solution: Play the sound only if there is a new contact and there is a significant velocity change. I would suggest using the postSolve callback on the first iteration of the collision to determine if the impulse is above some threshold value required to generate the ...


1

One way to approach this would be to represent the definition of the first bodies as Rectangles, then the problem of figuring out the position and rotation of the bridges goes aways as the bridge is always made up as a polygon touching the top corners of the Rectangle. The above image was generated using this approach, full source code below. It uses ...



Only top voted, non community-wiki answers of a minimum length are eligible