Tag Info

Hot answers tagged

5

I assume this is because in these cases the grid lines are not exactly on screen pixels, but somewhere in between. Is this correct? Yes, this is correct. The camera in LibGDX is based on a vector, which is made out of floats. When your camera is in between pixels (like at (1.2f, 63.5f)), then you will start to see that blur you mention because the ...


4

I don't know if it is because of a poor component that causes the false readings or a extremely precise component that registers the spinning of the earth, as it orbits the sun, as our solar system spirals through the galaxy. Either way, this is a common problem. The solution is to use some type of filter to smooth out the "extra" readings. There are ...


3

This is less a problem with Box2dLights, and more a problem with setting up Box2d collision fixtures to match your sprites. The Box2dLight rays are colliding with the CircleShape fixture you attached to the box2d body. CircleShape chain = new CircleShape(); chain.setRadius(10); Instead, this should be a Polygon shape with the same dimensions as your box, ...


3

For your first question you can optimize your method by only checking collisions with the border bubbles (only the bubbles that are actually exposed and not ones that are entirely surrounded). However, you can optimize this even further by using the fact that you know the coordinates of the bubble to find out approximately (or precisely, with some math) ...


2

pretty new to libgdx but i dont think it would be too hard to implement your own version of a "master volume" just have a float variable called master volume and then use it when ever you play your music and edit it how you please for example public static float mastervol = 1f; //playing your sounds sound1.play(mastervol); sound2.play(mastervol); ...


2

Your problem is that you are checking for a collision and then stopping, this means that if your frame places you to far into an object you are now stuck. To solve this you have to solve the equation of exactly where both object were when they hit one another. So you have to find where the following is true: |t*v1+p1-t*v2+p2)|=|r| where t is time v is ...


2

Sure, why wouldn't it? As stated on BadLogicGaming's Official Website: The license basically states you can do with the source whatever you want, copy it, modify it, include it in open and closed source projects without getting infected by the license itself. You can do whatever you want with what you made. Just make sure you comply to these 3 lines if ...


1

Short answer: by smart compositing rotation and translation. In the image below you can see the process (radius r is distance of your planet from star). If you rotate the moon by rot_m degrees(updated in main loop), it will circle the origin point. If you first rotate and then translate by radius r it will circle in right distance but wont follow your ...


1

Although libgdx largely abstracts away the OpenGL component for most of the basic things, you can still use it in your code for the more advanced stuff. Usually though, if you dig a round for a while you'll probably find that about 99% of the time whatever you want to do with OpenGL has already been implemented somewhere in libgdx. Source: ...


1

You seem to want to keep the same textsize/screensize ratio. Basically what you do is develop at one resolution and let that be scale 1.0. Then you divide the new screen width by the old width and that is your scale factor. For example. Developing on 2560x1440 with font size 16 and running on 1920x1080. Font size will be: 1920/2560 * 16 = 12 I do the same ...


1

Definitely not. Table is just a tool and you should use it when it fits your desired result. If your widgets are supposed to be laid out in a tabular way, then use Table. Otherwise, it's perfectly okay to position your widgets manually if that's what you need. Two alternatives to Table HorizontalGroup: Just one example of a component made specifically ...


1

I'm assuming that you may be doing setTransform() on PBox to move the player around based on mouse positions. If that's the case, it is bound to happen, since setTransform occurs outside of the physics calculations. Consider adding a Joint to drag the pBox around (with large force).


1

A simpler way, that will also speed up your program, is to check if your circle is moving towardas the other circle before check for a possible collision. You can do in it in this way: vector2 p; p.x = other.position.x - your.position.x; p.y = other.position.y - your.position.y; if(p.x*yourSpeed.x + p.y*yourSpeed.y > 0 { //check for collision; } look ...


1

You can initialize tile1, tile2 and tile3 and then you can add them to Array. tile1 = new Texture(Gdx.files.internal("grass.png")); tile2 = new Texture(Gdx.files.internal("dirttile.png")); tile3 = new Texture(Gdx.files.internal("watertile.png")); Here is how you will initialize Array: Texture[] tile = {tile1, tile2, tile3};


1

NEW ANSWER Found it. In the method setZIndex(), this line is the one that moves the children: children.insert(index, this); So the Z index is not a "true" z index which represents the depth, but the index of the children in the parent's children array. So if you try to put a child at position 3 in the array when there are only 2, it will be put at the ...


1

Your car is slipping for the same reason that a car hanging up-side down, riding the ceiling, with 100% friction would slip. 100% friction roughly means that 100% of the force exerted via the wheels on the terrain is used to counter movement perpendicular along the normal of the terrain. But this force still isn't enough to counter the force of gravity. This ...


1

Copied from here: http://stackoverflow.com/questions/15733442/drawing-filled-polygon-with-libgdx Basically, you define a PolygonSpriteBatch using a PolygonSprite and a PolygonRegion: PolygonSprite poly; PolygonSpriteBatch polyBatch; Texture textureSolid; You then create them like this, giving the region a texture and the 4 corners coordinates (for the ...


1

Why not using Actions.forever(Action repeatedAction) ? Example : fadeLoop = Actions.forever(Actions.sequence(Actions.fadeOut(time), Actions.fadeIn(time))); this.addAction(fadeloop)


1

So you need to call renderer.setView(orthoCamera) to reset the tile map drawing view. Then don't forget to also call camera.update() after you do anything to it.


1

If changes happen in an area, then you only need to update that area (rather than updating the entire map.) You could divide the array into an 80x60 array (I'll call them 'chunks'), each with 10x10x3, sections. With some basic data on who owns each larger section. So if the raising/lowering only happens in adjacent fields, and you know that all chunks ...


1

Your MyGdxGame class' render method doesn't do anything. It should call GameScreen.render() to render. Some comments about style: Variable names should be lower-case on their first letter (gameScreen not GameScreen) Please fix your formatting next time Suppressing warnings should be done carefully; they're usually indicative of a problem that may bite ...



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