libgdx

libGDX : Paint And Remove Color From Actor with touchDragged

℡╲_俬逩灬. 提交于 2019-12-25 03:52:41
问题 I created two-dimensional array of Button actor, then I added new ClickListener() { touchDragged } as the following code: buttons = new Button[3][3]; for (int row = 0; row < buttons.length; row++) { for (int col = 0; col < buttons[0].length; col++) { buttons[row][col] = new Button(drawable); buttons[row][col].addListener(new ClickListener() { @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { for (int row = 0; row < buttons.length; row++) { for (int col = 0;

libGDX : Paint And Remove Color From Actor with touchDragged

心已入冬 提交于 2019-12-25 03:51:24
问题 I created two-dimensional array of Button actor, then I added new ClickListener() { touchDragged } as the following code: buttons = new Button[3][3]; for (int row = 0; row < buttons.length; row++) { for (int col = 0; col < buttons[0].length; col++) { buttons[row][col] = new Button(drawable); buttons[row][col].addListener(new ClickListener() { @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { for (int row = 0; row < buttons.length; row++) { for (int col = 0;

Rended image not showing Java Libgdx

谁都会走 提交于 2019-12-25 03:38:23
问题 I am trying to render an image, however when i run the game as a a desktop launcher, the image can not be seen, however i believe the image is being rendered as it overlaps with another sprite to give an output. if (chicken.overlaps(farmer)){ System.out.print("GameOver"); gameOver(); I get no errors. Camera OrthographicCamera camera; camera = new OrthographicCamera(); camera.setToOrtho(false, 1920, 1080); camera.update(); inputUpdate(touch, camera); batch.setProjectionMatrix(camera.combined);

How to change size after it has been created

孤街浪徒 提交于 2019-12-25 03:26:19
问题 I am using java, libgdx, and box2d In main class I have created a player. I want to change shape.setAsBox to 100 in player class. So in other words I want to change shape.setAsBox after it has been created. I believe only way to do this is to delete fixture and recreate a new one with 100 size. How can I do this. public class main{ ... public main(){ //create player BodyDef bdef = new BodyDef(); Body body; FixtureDef fdef = new FixtureDef(); PolygonShape shape = new PolygonShape(); /***Body -

OpenGL ES 2.0 displaying objects in opposite depth order using LibGDX

夙愿已清 提交于 2019-12-25 02:27:05
问题 I am using LibGDX and rendering a few models. This works as expected, except objects that are "further away" are displayed "in front" of "closer" objects. In other words the depth order seems to be the opposite of what I intended for it to be. Strangely, the models are clipped in the correct order by the far clipping-plane. (Most distance objects disappear first) I have tried enabling GL_DEPTH_TEST , and I am clearing GL_DEPTH_BUFFER_BIT . Does anyone know what could be causing this? 回答1: If

How to detect touching/releasing two objects with two pointers

不想你离开。 提交于 2019-12-25 01:16:49
问题 I'm trying to touch two rectangle at the same time using two fingers. How can i implements that ? 回答1: Never mind I find a solution to this problem : public void detectTwoRectangleTouching() { if(Gdx.input.isTouched(0)){ int x = Gdx.input.getX(0); int y = Gdx.input.getY(0); if(rectangle1.contain(x,y)) isRectangle1Touched = true; else isRectangle1Touched = false; if(rectangle2.contain(x,y)) isRectangle2Touched = true; else isRectangle2Touched = false; }else { isRectangle1Touched = false;

libGDX: Using preferences for highscore

亡梦爱人 提交于 2019-12-25 00:04:53
问题 I know I have asked this question so similar before but I get there no more answer ... I would like, as soon as I lost in my game, my HighScore displayed. Here is the code: protected Preferences HighScore () { if (score > highscore) { prefs.putInteger("highscore", score); this.highscore = prefs.getInteger("highscore", 0); prefs.flush(); } return prefs; } But if I run my application, only this error is displayed: Exception in thread "LWJGL Application" java.lang.NullPointerException at de

libgdx change background after three attempts

最后都变了- 提交于 2019-12-24 21:40:55
问题 I'll formulate my previous question again. I want the background of my game change from day to night. This should be done after two or three tries to play the game. I have óne texture with different textureRegions for the day and the night. Any help is very much appreciated. I work with eclipse. this is what a have in my AssetLoader.java DAY= new TextureRegion(texture, 0, 0, 287, 512); DAY.flip(false, true); NIGHT= new TextureRegion(texture, 291, 0, 287,512); NIGHT.flip(false, true); This is

Android resource linking failed when i deployment target

我的未来我决定 提交于 2019-12-24 21:22:45
问题 I get this error when I select my android device. I'm using it for game testing with libgdx. Android resource linking failed C:\Users\oguzh\AndroidStudioProjects\Flying Smurfs\android\build\intermediates\ınstant_run_merged_manıfests\debug\processDebugManifest\instant-run\AndroidManifest.xml:11: error: attribute android:appCategory not found. error: failed processing manifest. And here is my manifest xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android

Screen responds when button is clicked

北城以北 提交于 2019-12-24 20:46:49
问题 Basically, I have a screen where I have a character and a button. Character jumps when I touch the screen (implemented using Gdx.input.justTouched). The button opens PauseMenu when clicked (button is an actor of a stage and click is implemented using button.addListener(new ChangeListener() {.... }). My InputProcessor is set on stage Gdx.input.setInputProcessor(stage); The problem is when the button is clicked my character jumps (but he shouldn't) and the pause menu opens. I was searching