libgdx,assets , Libgdx assets game design

Libgdx assets game design


Tag: libgdx,assets

I want to make a game with libgdx support 800 x 480 and 1280 x 720 screen. what size assets graphic design for game? is background image size 800 x 480 or 1280 x 720 ? thanks


You can use Viewports to deal with different screens and different aspect ratios.

If you need to reduce the file size of your png assets, you can use PngQuant :

Hope it helps.


How can I run a libGDX application on a non-GUI server environment?

I built a libGDX application that runs well on my PC desktop but when I try to run it on my Ubuntu server, it raises the following error: "LwjglApplication: Couldn't initialize audio, disabling audio java.lang.UnsatisfiedLinkError: /tmp/libgdxroot/31ce78a2/ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/../lib/amd64/ symbol awt_Unlock, version SUNWprivate_1.1 not defined in file with link time reference"....

TextArea.continueCursor( / ArrayIndexOutOfBoundsException: 16

What could be the cause of this error? (Can't figure it out) Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 16 at com.badlogic.gdx.scenes.scene2d.ui.TextArea.continueCursor( at com.badlogic.gdx.scenes.scene2d.ui.TextArea.calculateOffsets( at com.badlogic.gdx.scenes.scene2d.ui.TextField.draw( at com.badlogic.gdx.scenes.scene2d.Group.drawChildren( at com.badlogic.gdx.scenes.scene2d.Group.draw( at...

Admob slows down my game - LIBGDX

I have my game perfectly optimized. Doesn't go bellow 61-60 FPS. When I finish the level or the user dies the pause/restart dialog appears (Scene2D). The problem is that I still have moving sprites in the background and it would make the game look not so good if I would...

LibGDX - load and process texture asynchronously

There are a few discussions about async loading textures using Assets in LibGDX. As far as I know LibGDX uses 2 methods (async & sync) to load data. In case if it's rely on using OpenGL functions, it uses main thread with GL context and does it synchronously, otherwise asynchronously....

“Tainted canvases may not be loaded” Cross domain issue with WebGL textures

I've learnt a lot in the last 48 hours about cross domain policies, but apparently not enough. Following on from this question. My HTML5 game supports Facebook login. I'm trying to download profile pictures of people's friends. In the HTML5 version of my game I get the following error in...

Using world coordinates

I am currently using pixels as units for placing objects within my world, however this can get tedious because I only ever place objects every 16 pixels. For example, I would like to be able to place an object at position 2 and have the object rendered at the pixel...

Box2d Body to follow mouse movement

I am trying a box2d body to rotate following the mouse. Here's an image to clarify what I mean. The red and blue circles are current point of the mouse and the body (of corresponding color) moving/rotating to follow it. Basically the rectangle should rotate with its one end pointed...

Heroku and Precompiled Assets

I have a Rails 4 app. One of my javascript assets uses ruby to get all Users. A problem arises when I try to upload to heroku. It says that it cannot precompile that asset because the database does not yet exist. What can I do short of removing that...

How to remove Sprite/Object from ArrayList? [duplicate]

This question is an exact duplicate of: Removing sprite when Touched 1 answer I created an ArrayList just for the sprites that needs to be removed, when the sprites are touched they are added to the ArrayList. //drawing the enemy that spawns and making them move public void draw(SpriteBatch...

Libgdx: File not found error 'Internal' when opening external file

Here is a good one for you. I'm trying to open a file using external. FileHandle dirHandel = Gdx.files.external("MyApps/skanectModel.g3db"); boolean isDir = Gdx.files.external("MyApps/skanectModel.g3db").exists(); I know the file is there, and the bool tells me that in fact it is there. The main problem is that I get this error. Caused...

libgdx drawing arc curve

The arc function of libgdx instead of drawing a arc draws a pie segment (ie. has 2 lines connecting to the arc's origin) shapeRenderer.begin(ShapeType.Line); shapeRenderer.arc(x, y, radius, 30, 120); shapeRenderer.end(); Is there a solution to this problem so that libgdx can draw an arc curve similar to the html5 canvas...

Javascript in Yii2 AssetBundle is not published on update

I have a quite simple AssetBundle: use yii\web\AssetBundle; /** * ImagizerAsset */ class ImagizerAsset extends AssetBundle { public $sourcePath = '@app/components/widgets/imagizer/assets'; public $css = [ 'css/imagizer.css' ]; public $js = [ 'js/imagizer.js', ]; public $depends = [ 'app\assets\BowerCropperAsset' ]; } If I change the JavaScript in the bundle, it is...

For-loop gives only one value when iterating through an array of Vectors (libGDX)

I'm just a beginner, so here's probably some small mistake which I can recognize but yeah... I'm using libGDX library and here's code of my method: public Vector2[] initCollisionStart() { int i = 0; for (int row = 0; row < currentMapHeightTiles; row++) { for (int col = 0; col...

I have an Array of 2 objects, when I use a for loop, both of the object gets the change that only one of them should have

Basically I have this code : for(int i = 0; i < tnt.size; i++){ TNT t = tnt.get(i); if(cl.isVänster()){ t.getBody().setLinearVelocity(6,0); } if(cl.isHöger()){t.getBody().setLinearVelocity(-6,0); } if(t.getBody().getPosition().x > 1888/PPM){t.getBody().setLinearVelocity(-6,0); } if(t.getBody().getPosition().x < 31/PPM){t.getBody().setLinearVelocity(6,0);} } What happens is if I have 2 objects in this Array, when something happens to object #1 it gets...

Laravel 5 adding invalid chars at end of JS

I'm including a JS file with the following tag in my app.blade.php: <script type="text/javascript" language="javascript" src="/js/colors.js"></script> Whenever that script loads in the browser, it contains a bunch of invalid characters at the end. I've verified that these characters are not present in the actual file. Has anyone seen this problem?...

Pixelated texture filtering distorted

I've created a isometric tile based game in Libgdx. The textures I'm using are 64x64 and packed using TexturePacker into a TextureAtlas. They are then drawn onto the screen. However, while moving around the pixelated edges of the 64x64 texture flicker and they are distorted, which can be seen in...

Symfony2 - assets do not load

Today again something doesn't work in my symfony2 test project. Now i'm trying to use some assets like .css file and images. What did i do so far? Bundle name is MyValleyBundle so in AppKernel.php bundle is registered: new My\ValleyBundle\MyValleyBundle(), I did put files respectively css to css, images to...

Using comparable to compare different variables

I'm familiar with standard comparisons using the Comparable interface, although today I'm having some trouble when I want to compare several different variables. I basically want to implement a compareTo method that yields the result -1 only when the following if statement is true: if (o.maxX > minX && o.maxY...

Java - LibGDX - Problems with the process of rendering a Tiled map

The problem I cannot seem to be able to get Tiled maps to render properly. I am using LibGDX as a library for loading the map (Release 1.6.0). Video demonstration I have created a video to show you the actual problem and make things easier by skipping the whole process...

Does the game engine allow me to intergarte native android code

I am looking into using Game Engine for one of my apps. I have been android developer for a while but never used a game engine. I know the most famous engines out there are AndEngine, Libgdx and Unity Which engine would allow me to use the native android code...

Using abstract screen in LibGDX

I want to use an abstract screen for my LigGDX game. I have read many websites and many of them use abstract screen only to group the common codes (e.g. common methods) together. If this is the case, we can simply use a normal class to do the task. The...

LibGDX- Unexpected computing by libgdx

i recently had problems of FPS drop (~40 FPS), and when i searched where it was. I saw that it wasnt me, all my calculation were done in 7 ms which is far from the 16 ms limit. This is the code i used : long time = 0; public...

libgdx keyDown distinguishing a long and short press

Is there a way to handle a keydown that is just one click versus a keydown that is a long press in libgdx? Does it have anything to do with a gesture detector? to clarify, my question is about keyboard events, not touch and mouse events

andriod out of memory exception

please help in solving me this out of memory exception as i am unable to solve it, any help would be greatly appreciated, 06-04 12:11:44.119: E/AndroidRuntime(9090): FATAL EXCEPTION: main 06-04 12:11:44.119: E/AndroidRuntime(9090): Process: com.zar.bdr, PID: 9090 06-04 12:11:44.119: E/AndroidRuntime(9090): java.lang.OutOfMemoryError 06-04 12:11:44.119: E/AndroidRuntime(9090): at Method) 06-04 12:11:44.119: E/AndroidRuntime(9090): at...

Libgdx : Detect empty TextureRegion

I've been building a little game in Libgdx for a couple of days now and I wanted to implement some kind of dynamic sprite-analyzer. I have a png-file that I split into TextureRegions and build a Animation out of. So I split up the Image in 64x64 Regions and iterate...

How can I use the Accelerometer for detecting jump in LibGDX?

I make an app for android. I'll use the accelerometer for detecting jump.Does someone know how that works? And which value will change and with how much?

Saving Sprite Position

I have a sprite that when reaches a certain position it gets removed: if(sprite.getY()>=700){ enemyIterator.remove();; } I wan't to save the last position of the sprite before it gets removed,I tried sprite.getX() and sprite.getY() but those are only usable while the sprite is in the game....

Calculation position of a Vector between two others

I think my current problem is related to intercept theorems that everybody learned at school, but that was quite some time ago and I am kind of getting stuck halfway. My Problem: I have two Vectors in a 2 dimensional space called v1 and v2. What I want to know...

Saving WPF Assets

I am creating a WPF app where I'd like to create an Assets folder which will contain my images etc, then access them via a relative path, if possible. Assuming my folder structure is as follows: Application > Bin > Debug > EXE Where should I create my Assets folder?...

Libgdx sliding screen transition

I have a libgdx project with a Game as the base class and two Screens (my menu screen and my splash screen). I want, when the splash screen has finished, to slide the splash screen to the right and put the menu screen. I can just make an instant transfer...

Android LibGDX 'Cannot resolve symbol setRadius'

I'm using Box2d, libGDX and have imported ...physics.box2d.CircleShape; what did I do wrong such that setRadius isn't acceptable. Thanks for your time. import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputProcessor; import; import; import; import; import; import; import...

Player Movement Direction Logic

Consider points A and B as walls and point O as player inside walls. So they look like A O B. I want player to move left when he touches rightPoint B. And move right when he touches leftPoint A. The screen is being rendered and player position is either...

Java libGDX will not draw sprites when the camera coordinates do not match the window coordinates

I am having a problem with the libGDX engine. I have a pair of variables to set the width and height of the screen, and another pair to set the width and height of the camera. However, whenever the camera is not the same size as the screen, the engine...

Libgdx Trigonometry Wrong Angle

I am building a top down shooter like Counter Strike 2D there is problem with velecity: public class Player extends Entity { private float moveSpeed; private float turnSpeed; private float maxSpeed; private float moveFriction; private float turnFriction; private Texture tex; private Sprite sprite; private ArrayList<Bullet> bullets; public Player() { moveSpeed...

BitmapFont class does not have getBound(String) method

Previously I used getBound method for BitmapFont class in libgdx, but now, I am unable to use it. I cannot find the changes in latest version. Any help is appreciated. Thank you...

Is it possible to modify libgdx's Table cells?

I'm using libgdx Table to show some info. This information can change sometimes. I would like to change the cells so that they reflect the updated values. Is this possible or are Tables designed to be static? To clarify, I would like to do is something like this: class MyTable...

Delaunay triangles point connectivity?

I was watching this video: Delaunay Triangulation and I want to use this to generate procedural content in the same way. I had a pretty hard time figuring out how to work with the DelaunayTriangulation class supplied by LibGDX but I guess I finally figured it out. My question however...

Set up wraparound effect in libGDX with Box2D

i have been having trouble trying to set up wraparound in LibGDX using box2D, for example i want my player to appear at the left side of the screen after exiting the right side, but its not working here is my code: public void setWraparound(){ //if player goes out of...

LibGDX could not parse tmx file: file not found

I'm attempting to show an isometric tiled map using LibGDX and Eclipse. However, when running the project i encounter this error(s): Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing file: E:/Documenti/eclipseiso/desktop/map.tmx at com.badlogic.gdx.utils.XmlReader.parse( at com.badlogic.gdx.maps.tiled.TmxMapLoader.load( at com.badlogic.gdx.maps.tiled.TmxMapLoader.load( at

Libgdx: Objects creating other objects

I have kind of a general question about a simple game architecture. In my game I have these classes: Main class who's responsible for drawing and rendering. Ball object which has a few attributes and update() function that does certain things. The main class has an array of all exist...

How to remove Sprite when collision is detected? Libgdx

Every random time (between 1,2 and 3 seconds) a rectangle and a sprite is created,1 rectangle for each sprite that spawns. new enemy method is called at random time: public void newEnemy(){ Sprite enemy= Pools.obtain(Sprite.class); enemy.set(enemySpr); enemy.setPosition(200,150); enemies.add(enemy);} the same thing happens to rectangles: public void newRect(){ Rectangle rect=Pools.obtain(Rectangle.class); rect.set(enemyRect);...

FacebookSDK on Android - SharePhotoContent with Message body

I have a button in my game where I make a finish level screen capture , I then attach that picture to a Facebook SharePhotoContent dialog from the newest SDK. It all works as it's supposed but how do I also insert a custom message body so that I replace...

How do I remove Sprites when they go on a specific position?

My Sprite are spawned at a random time, after being spawned the the move upward until they get on a certain position then they should be removed. That's what I've been trying to do but I always get an error. //this method is called at random time public void newEnemy(){...

.\key.p12: open failed: ENOENT (No such file or directory)

In my android application I'm accessing the Google cloud storage . I have generated the private key xxxxxxxkey.p12 .I have put my key file in assets folder . But while running the project it is not opening the key.p12 file . I have tried putting it outside the assets folder...

Display loadingwheel during method

I share an image to different social medias, but this process takes a few seconds and can make the user think nothing is happening. So I want to display a loading wheel sort of. I got the animation finished but I can´t work out how to implement it so that...

LibGDX TextureRegion draw bug when using split method and scaling

I get a graphical glitch whenever I try to split my tileset into a TextureRegion[][] and drawing them. It works fine when I am using the default aspect ratio but when the window has to stretch, it seems to be accessing a line of pixels from the next tile in...

How do i correctly rotate an image in LibGDX?

I am trying to make a game like asteroids, i want the player to face and move upwards (North) but when the game starts,the player is faceing to the right side(east). here is my code: public Player(float x, float y,int width,int height) { this.width = width; this.height = height; this.x...

Android app crashes when using AsyncTask for fetching an url with jsoup

So the app shows up the dialog while loading but then crashes. Te reason I decided t use these technologies is because I have to load an html, which changes dynamically and there are heavy CSS files which I would like to cache, so I think including them as assets...

Launching Libgdx project to IPhonesimulator

Im trying to make sure my app works on IOS. And doing so by trying to launch it to a IPhonesimulator on my mac. doing: ./gradlew ios:launchIPhoneSimulator Makes my app start on the simulator, the standard splashscreen by libgdx appears and then it shuts down and nothing more happends. But...

Libgdx Texture Size Android

I'm having problem with scaling images ,every device has different screen resolution and i can't figure out how scale them down in the Libgdx Platform, for example today i've made a small game for android and the problem that i am facing is.. offcurse we can scale them down ,but...