Tag Info

New answers tagged

0

Disclaimer: I am a Nextpeer employee. If this issue is still relevant, Nextpeer supports a simple Player-to-Player communication model that empowers games and lets them perform real time interactions between players. This can be used to have a action taken by some player affect the rest of the players in the current tournament. For example, a player ...


0

It's easy, you just need to set the width during the insertion of the items on your table. Example: dialog.getButtonTable().add(btnSound).width(900);


1

Imagine the radius is one. That means every point around the circle is exactly one unit away from the center. Now what kind of vectors always have a length of one? Unit vectors of course. You can get a unit vector by normalizing a non-unit vector. Take the vector CA (center to A). Next, normalize CA to make it a unit vector, then scale it by the radius of ...


0

I have my answer. On this NetBeans-Gradle guide https://github.com/kelemen/netbeans-gradle-project It states: "and is also available via the Update Center (Tools/Plugins: Look for "Gradle Support")." So yes "NetBeans IDE Update Center" is Tools > Plugins


2

It means desktop. You have two options to deploy your libGDX app to the desktop: Create a self-runnable JAR. This is easier (Eclipse can export it pretty easily). Create an EXE, via launch4j (or some other wrapper). This is possible too (especially with Gradle). I've used both approaches and they work equally well as far as I can tell. Both rely on ...


0

You created the voids to instantiate the sprites from separate class but you forgot to call them before the render() method. Insert separateClass.player() and separateClass.Wall() in the show() method and it should work. ps : Do not forget to first start your separateClass (separateClass sClass = new separateClass(parameters))


0

Setting a uniform per sprite is probably not a good idea, as Sean Middleditch already pointed out. Tinting a sprite in OpenGL can easily be done by defining the vertex colors. Since the vertices in this case are defined by SpriteBatch.draw(), you should set the tint with SpriteBatch.setColor(). From the SpriteBatch source code: 200 public void setColor ...


0

I don't know if this is the Problem, but your LibGdx.onCreate() is calling LibGdx() which calls the onCreate() again.


0

I ended up redoing to algorithm for building the map. This seems to be working really really well I wrote this to build it, this basically makes a body for each tile, if there are tiles next to each other, horizontally, it will group them together and create a single body for those tiles private static void buildCollision(Map map, World world){ ...


2

Your server is more authoritative than it needs to be. The client needs to start moving as soon as the button is pressed, so there is no perceived lag. The server can then essentially replicate packets for other players, (maybe run a physics-sanity-check against a stored world model to prevent cheating, like warping through walls and such). Time stamping the ...


0

If you can make the ball travel to the center of the vortex, you have half the answer. In potential flow theory, this is known as a sink. The other half of the answer also comes from potential flow theory, where you can make use of the irrotational vortex: "Irrotational vortex" by Silver Spoon is licensed under CC BY-SA 3.0 The equation describing the ...


1

You could try using a Camera when drawing your images. Create a new OrthographicCamera like so: OrthographicCamera cam = new OrthographicCamera(VIRTUAL_WIDTH, VIRTUAL_HEIGHT); Now when you create your viewport, pass the camera into the constructor. Viewport viewport = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, cam); Now in your render method: ...


0

My answer might be too shortcomed if I am missing something, but if all you want is to add additional force to spin things in a vortex way, all you need to do now is to act another force on each of the affected bodies, which goes in the tangent of the angle between it and the vortex center. So, if angle is the radian angle between the vortex center and the ...


0

Change your actor body so the lower part is an arc. Like this it should be able to get over small steps and or walking up/down diagonal slopes.


0

Firstly, going left and down to find the nearest chunk isn't necessary - chunk/local (that's the pair of terms I use in my engine) can be calculated like this: ChunkX = Floor(PlayerX / ChunkWidth) ChunkY = Floor(PlayerY / ChunkHeight) The position relative to that position can be calculated like this: LocalX = Floor(PlayerX % ChunkWidth) LocalY = ...


0

You can call .setText("Some String"); on your label in your Render-method.


0

The way Box2D resolves collisions results in it working very poorly with tiles maps where the tiles are converted into square bodies. It is best to have a separate layer for specifying objects to use for collision which is completely separate from the graphical information for the tile map. You can then use this object layer to generate the Box2D bodies ...


1

Easiest way is to set the visibility to false tiledMap.getLayers().get(index).setVisible(visible); EDIT: Reference to the libGDX API http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/MapLayer.html#setVisible-boolean-


1

Unfortunately, there is no magic: the only good way is to implement resolution independence yourself. While libgdx may be of some help, it's not going to solve your every problem. For my NoThree puzzle game (see profile for link), I drew my graphics in Inkscape and I exported several resolutions (144x144, 72x72, 48x48) for each texture (the font is also ...


0

If i understand this correctly then you take some data and then as part of the rendering process you distort the postition of that data ... this.camera=new OrthographicCamera(); this.camera.translate(map.getMapPixelWidth()/2, map.getMapPixelHeight()/2); this.camera.update(); view=new StretchViewport(map.getMapPixelWidth(),map.getMapPixelHeight(), camera); ...


1

Actually it's already present in Vector2 class. You can use something like this: Vector2 touchPoint = new Vector2(211,312); // random touch position Vector2 center = new Vector2(world.getWorldWidth() / 2, world.getWorldHeight() / 2); // center of the world float width = touchPoint.sub(center).len(); // length of resultant vector float angle ...


0

There are two [main] types of controller input. There is DirectInput, and there is xInput. PS3 controllers use DirectInput, while xInput is Microsoft's choice (they made it for the xbox, I think). Both of these controllers are supported in LibGDX. However, they are different in how you get data. For example, DirectInput doesn't handle analog trigger buttons, ...


1

This is very simple, actually. You don't need to translate the camera (that is dealing with Matrices, I think?) using the "translate" method. You can simple set the camera's position to your sprite's position (assuming you use the x-y coordinates where (0, 0) is the bottom-left corner. Or extend the "Sprite" class; either way should work). In your camera ...


0

Are you sure this is not working? I tried to reproduce and it's working just fine. (*) You wrote that the TextFieldListener is just working fine, so I assume you've set the InputProcessor to the stage, right? Just in case you did not and did some black magic (or rather for others who might face a similar error): Gdx.input.setInputProcessor(stage) (*) ...


0

Put your ImageButton in a table. Set the size of it. Add the table as an actor in your stage. Here is an example: ImageButton. ImageButton Style btnStyle new ImageButton.ImageButtonStyle (); btnStyle.up = skin.getDrawable ("your image"); btnB = new ImageButton (btnStyle); stage.addActor ( table ); table.add (btnB).size (150, 200);


1

I have never used a viewport without a stage, but replacing width and height with the calls to Gdx.Graphics.getHeight/getWidth that you are using causes the same behavior you are experiencing. Removing those calls and using the passed values should fix your problem. public void resize(int width, int height){ stage.getViewport().update(width, height, ...


0

You need to transform the world space rotation vector to model space before applying the rotation. Vectors are transformed with inverse transpose of the matrix, i.e. v'=transpose(inverse(M))*v Because models generally define model->world matrix you need to invert this to get world->model matrix. So you need to calculate v' = ...



Top 50 recent answers are included