libgdx

Libgdx 1.3.0 doesn't build eclipse files

我与影子孤独终老i 提交于 2019-12-02 09:02:21
I saw that version 1.3.0 of libgdx was available so I got it and when I use the project setup to setup a project I check advanced > build for eclipse and hit generate but when I try to import it into eclipse it says no projects found. Version 1.2.0 worked perfectly for me before 1.3.0 was released now I can't even get that version to build eclipse files. Any fixes and I don't use gradle. EpicPandaForce Try importing the projects as Gradle projects. To do that, do the following: Opening LibGDX project in Eclipse (ADT Bundle) The new ADT 23.0.2 does not allow installing the Gradle Integration

How do I fix a NoClassDefFoundError while launching Android LibGDX Project?

北城以北 提交于 2019-12-02 08:39:50
问题 I am currently learning the LibGDX game engine (version 1.9.4) and I keep running into a compiling error when trying to run my android version of my project. I did some research and found this article and followed the solution that was listed on that question but the same issues keep occurring log.txt. I tried adding the core file directly to the build path like so but still the same issue. Is there something I'm not understanding about the error message? If so what is it? Thank you in

ChainShape in Box2D

感情迁移 提交于 2019-12-02 08:39:37
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 code I used so far: Vector2[] box = new Vector2[4]; box[1] = new Vector2(0 - bounds.getWidth() / 2 / Main

Android libgdx preferences not working

て烟熏妆下的殇ゞ 提交于 2019-12-02 08:14:17
问题 Probably a stupid question, but what do I have to change to make this code work: package com.hobogames.WizardsDuel; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; public class GameData { public static String version = "1.0.0"; public static String data[] = {"version"}; public static final int VERSION = 0; public static Preferences prefs = Gdx.app.getPreferences("WizWars"); public static boolean played = (!prefs.get().isEmpty()); public static String getString(int key){

libGDX HTML5 deployment exception

主宰稳场 提交于 2019-12-02 07:51:08
问题 I am trying to compile the libGDX project using GWT (libgdx-project-html right click -> Google -> GWT Compile). I get no errors while compiling except com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target java.lang.StringIndexOutOfBoundsException but since I'm not using this util should not be a problem. After the compilation says that it was successful, I ran the local hosted site. LibGDX logo and loading bar come up (fine until here), and when they are done, I get a black game screen and

How to restart screen in LibGDX using Init() methods?

£可爱£侵袭症+ 提交于 2019-12-02 07:50:26
I created a simple game in LibGDX that has multiple screens. I want to restart a certain screen after touching a restart button but I'm not sure how to do that. I made some research about this and all answers lead to not loading my assets in show() but rather in an init() method that I am not really familiar with. I want to know how can I restart a screen using this init() method . As of now I put most of my initialization in the constructor and some were initialized in methods such as the restartButton() method. Any other corrections or improvements in my code will be highly appreciated. Here

How to create whirlpool/vortex effect?

谁都会走 提交于 2019-12-02 07:49:29
问题 Im trying to make a Vortex effect on a Circle Body that is a Sensor. I've been looking for this and all examples i look for are in C++ or Objective C and i dont seem to translate them well. when my objects collition, it calls beginContact(..) and it sets a flag so that i can call bodyToUpdate.applyForce(...); public void beginContact(Contact contact) { setColliding(true); } //updating collition every frame public void act(){ if (colliding) { ball.getBody().applyForce(....); } how to calculate

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

江枫思渺然 提交于 2019-12-02 07:41:17
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? 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 sprite rotation, maybe is not the best way but it occurred to me that right now. Like this helps you, if your

Google Sign-In with LibGDX

删除回忆录丶 提交于 2019-12-02 07:37:57
I've a problem. I'm making a game with LibGDX. Now I want to implement Google Sign-In. I searched everywhere, but can't find anything. What I need is a Resolver to abstract code for specific platform, but I don't know how to do it. Can someone help? EDIT Here's the code, this is my Android Resolver: public GoogleResolverAndroid(final Context context) { handler = new Handler(); this.context = context; GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this.context) .addApi(Auth

libgdx changing sprite color while hurt

别说谁变了你拦得住时间么 提交于 2019-12-02 07:26:13
I am using libgdx to make a little platformer and I would like to make the enemies blink in red while the player hurt them with his weapon. I already tried to change the sprite color and the sprite batch color with no success, it only melt the new color with the one of the texture. sprite.setColor(Color.RED); spriteBatch.draw(sprite); the effect I want to achieve is: going from sprite texture to full red and then back again. I think there is something to do with the Blending function, but I am not sure about that. I want to avoid making some red sprite for each monsters of my game. Does