libgdx

how to implement Fling on group

冷暖自知 提交于 2019-12-02 07:13:40
I want to fling some images after some animations on them are over, and the animations run inside a window: The red one which is above the other one, what I tried is: if (xDn - xUp > 0) { Timeline.createSequence() .beginParallel() .push(Tween.to(GBMImage, SpriteAccessor.X, 0.2f) .target(170f)) end().start(tweenManager); } where xDn and XUp are ontouchDown and ontouchUp x values. To move the image left and right. Now the problem is on left, fling image goes over the back window, which I want to go beneath the red window. Secondly the above code is working for single image, I'm not able to

How to create whirlpool/vortex effect?

时间秒杀一切 提交于 2019-12-02 07:09:33
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 the amount of force to apply every frame to make it a vortex? Edit: so i now have the object going

Changes in code aren't reflected when I run Libgdx project on Android

女生的网名这么多〃 提交于 2019-12-02 06:54:34
问题 I've been following the Libgdx tutorial here and I'm running into a strange problem. Due to the constraints of my work environment, I can't download OpenGL drivers on my desktop, so I can't test my application on the desktop. I have to test it on my Android device. It's running some variation of an Android 2.3.4 build, which is API level 10. The problem is, whenever I make changes to my code and run the Android application, the changes aren't reflected. It just starts the build it installed

How to decrease loading time of all Assets in libgdx

女生的网名这么多〃 提交于 2019-12-02 06:15:59
I am making a game in libgdx. I use AssetManager class to load assets. When I start my game its takes more time to load assets on android device and show black screen at that time.How can I resolve that problem. Well it will show a blank screen. In order to solve this problem you can render something while loading of assets is done and as the loading is done you switch to menu screen. import com.badlogic.gdx.Gdx; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.GLCommon; import com.badlogic.gdx.graphics.OrthographicCamera;

Libgdx: Lags in soundtrack looping

你离开我真会死。 提交于 2019-12-02 06:09:51
I'm having trouble with music looping in libgdx. I know a simmilair topic was here before, but it didn't help me at all. The thing is that when you go to main menu in my game ( link ) the sound of rain is looped. Unfortunately, there is a short moment of silence between each play and I don't know why - you can download the game and see what I mean. I'm already using .ogg format, so the solution from the other topic I found here didn't really help. If I play this sound in a loop in Audacity, it works perfectly. Here is my code (I don't think it'll help, though): rainSoundtrack = Gdx.audio

Libgdx camera/scaling issue

穿精又带淫゛_ 提交于 2019-12-02 06:07:14
This is just a really quick post wondering what i have done wrong? I want the background to be filled on the whole screen with whatever screen sizes i have but this does not make it work. Here is all the code: // Variables Jump game; OrthographicCamera cam; SpriteBatch sb; // Variables public SplashScreen(Jump game) { this.game = game; cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.translate(cam.viewportWidth / 2, cam.viewportHeight / 2); sb = new SpriteBatch(); } public void show() { } public void render(float delta) { Gdx.gl20.glClearColor(0.2F, 0.6F, 1F

Touch code only working at center of screen in my ball game using libgdx

自古美人都是妖i 提交于 2019-12-02 06:04:38
问题 My score does not increment after I touch the ball. It increments only when I touch the ball and its near the center of my screen. When my ball only moves in x axis keeping y constant the touch works fine. But when both are incremented the score increases only when touched at the center. @Override public void render () { batch.begin(); Gdx.gl.glClearColor(1,1,1,1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.draw(ball,xposi,yposi,100,100); if(gameState==1) { if (Gdx.input.justTouched()) {

LibGDX very strange bug - objects are disappeared

自古美人都是妖i 提交于 2019-12-02 06:04:06
When I was creating my first tiled map creator in libGDX , I noticed a very strange bug. I creating grid of objects like this: private static final int GRID_WIDTH=2400; private static final int GRID_HEIGHT=2400; private static final int CELL_SIZE=60; so you can see there are 2400/60x2400/60 objects or cells. I am creating my map like this: private void createMap(){ cells = new Cell[GRID_WIDTH/CELL_SIZE][GRID_HEIGHT/CELL_SIZE]; for(int i=0;i<GRID_WIDTH/CELL_SIZE;++i){ for(int j=0;j<GRID_HEIGHT/CELL_SIZE;++j){ cells[i][j]=new Cell(textures[0],i*CELL_SIZE,j*CELL_SIZE); } } } I also have

Libgdx, Transitive dependencies Android,Java library project, Jar

情到浓时终转凉″ 提交于 2019-12-02 06:00:33
问题 I have just created template Libgdx project (Core,Android,Windows). Core is regular Java project library. There is a dependency in Core to XStream.jar library. Core contains file input-output via Xml. Android project has dependency to java core project. Now XStraem is working for Windows but not for Android. For Android i got this: 01-22 13:03:24.141: E/AndroidRuntime(25074): FATAL EXCEPTION: GLThread 5187 01-22 13:03:24.141: E/AndroidRuntime(25074): Process: com.barsoft.drag, PID: 25074 01

transparent circle black around

让人想犯罪 __ 提交于 2019-12-02 05:58:59
问题 I'm trying to make transparent circle and everything around black with alpha. I'm using this code and it somehow doesn't work. Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_DST_COLOR, GL20.GL_ZERO); Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD); shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); shapeRenderer.setColor(new Color(1, 1, 1, 1f)); shapeRenderer.circle(150,500,300); shapeRenderer.end(); Gdx.gl.glDisable(GL20.GL_BLEND); I want this: 回答1: You can use FrameBuffer for your