libgdx

ChainShape in Box2D

蓝咒 提交于 2019-12-02 19:11:17
问题 I recently began to learn libgdx and I am stuck at a problem with the CainShape of Box2D. My first goal is to simply create a box with a ChainShape. In order to achieve that, I added four Vector2 to an array and use them to create a loop. The result is depending on the arrangement in the array either an hourglass shaped thing (top left is connected with bottom right and top right is connected with bottom left) or the error Expression: b2DistanceSquared(v1, v2) > 0.005f * 0.005f This is the

Libgdx special effects in 3D

三世轮回 提交于 2019-12-02 18:11:50
问题 I am trying different libgdx features to develop a 3D game for android, as it works very fine upto loading 3D models and perform animations on them. Now the big problem i found that its difficult to produce complex 3D effects like shooting, fire etc. Without them it won't look real. I know about particle editor but I am working on ubuntu 14 system where its not working properly. I have used 'particle system' from this page for basic effects libgdx 3d particle effect So any ideas? If you have

Physics Body Editor error

女生的网名这么多〃 提交于 2019-12-02 17:58:05
问题 I get this error when trying to initialize BodyEditorLoader from this library http://www.aurelienribon.com/blog/projects/physics-body-editor/ Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127) Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape

libgdx difference between sprite and actor

亡梦爱人 提交于 2019-12-02 17:28:57
I'm just going through the javadoc and various tutorials on libgdx and I'm at the stage of trying to figure out differences between various concepts that seem similar to me or provide similar capabilities in libgdx. At first I thought scene2d was about creating interactive items such as menus, etc but various tutorials I'm reading use scene2d/actors for the main game items (i.e. the player, etc) and others just use sprites. What exactly is the difference between using Sprite and Actor (i.e. scene2D) in a game and when should you choose? Thanks. A Sprite is basically an image with a position,

Removing sprite when Touched

丶灬走出姿态 提交于 2019-12-02 15:50:53
问题 The sprite is spawned every second and when it's touched, it should be removed. This is what I did: //Render the sprites and making them move: public void draw(SpriteBatch batch) { for(Sprite drawEnemy:enemies) { drawEnemy.draw(batch); drawEnemy.translateY(deltaTime * movement); touchInput(drawEnemy.getX(),drawEnemy.getY(), drawEnemy.getWidth(),drawEnemy.getHeight(),drawEnemy); } } //Detecting the touch input: public void touchInput(float x,float y,float w,float h,Sprite sprite){ float touchX

Boolean not changing in thread

試著忘記壹切 提交于 2019-12-02 15:44:59
问题 I have a class MPClient and MultiplayerMatch. MultiplayerMatch, in his constructor, creates a MPClient runnable thread. To avoid data overflow, I have a boolean named "moved" in MultiplayerMatch that changes to true when the player is moving. In the updateMatch method, if there's any player movement, "moved" changes to true, which allow MPClient to enter an if statment (inside while). This way MPClient only sends data to the server when something changes on the game. Neverthless, when the

Rotate Texture in function of player position

China☆狼群 提交于 2019-12-02 14:43:14
问题 I'm making a 2d game that consists in a plane fighting against spaceships trough missiles, i want the spaceships to rotate in function of the player position, so that they are always facing the player with the "head". The player can move freely in the y and x directions. THe player and the spaceships have a Vector2 pos variable, that corresponds to their actual position. Any help would be appreciated. This is my (now working) code: public void render(SpriteBatch sb) { Vector2 temp = new

LibGDX - Rotate a 2d array of sprites around their center

非 Y 不嫁゛ 提交于 2019-12-02 14:36:05
问题 I have a square 2d array of sprites and im trying to rotate all of them around the center position of the map, but after many attempts the sprites seem to be only rotating around their own center. Is this possible? 回答1: the first thing that comes to mind is, if I understand your question, you tell all sprites where is the point which must rotate using: sprite.setOrigin(yourPointVector2.x, yourPointVector2.y); sprite.rotation(yourRotation); Edit new edited for your comment simple test for 1

Keeping track of unnamed objects

冷暖自知 提交于 2019-12-02 13:20:44
I want to make a top-down 2d shooting game using libgdx. There will be a lot of bullet objects that I want to keep track of and dispose when they go off the screen. I was thinking that I would use something like static ArrayList<Bullet> bullets; to keep track of my bullets in the Bullet class, check this array list for any bullets that are off the screen, dispose of them if they are, and delete that bullet from the ArrayList. I was wondering if this is the best way to do this. It seems like something that should be pretty common and so I wanted to make sure that this is the best way of doing

libGDX: Hanging rope knotted with some pivot

百般思念 提交于 2019-12-02 12:03:02
问题 I am trying to make a hanging rope having some object at it lower end in libGDX, Rope should be like hanging rope in Box2D I have done a lot of research, libGDX has its ropeJoint method but how to use it to make a rope? Please help, It will be a great favor. 回答1: I've started with the answer to a similar question libGDX: Hanging Rope and added some code to it to add some missing code and fix some problem in anchor, I think the following code is a suitable to the target proble: BodyDef