libgdx

Collision detection for an arc of a circle

雨燕双飞 提交于 2019-12-08 02:49:26
问题 So how do i implement the collision detection for an arc of a circle? Will i have to use the Box 2d collision or can i do it some other way using Rectangle or stuff like that? BTW I hate box2d because i dont understand most of the things in it, so if there is a solution that excludes the box2d, it will be very much appreciated. The yellow arc keeps on rotating over the black circle. How do i implement collision detection in here? Please help ! Thanks! 回答1: To avoid using Box2D you could

In libgdx, how do I add friction to a box2d Body object?

不羁岁月 提交于 2019-12-08 01:54:51
问题 I'm having an absolute blast with libgdx, love using it. However, I am a newbie with box2d, so I was hoping someone smarter than me could help me out. I have a simple test screen, where a bunch of static square tiles make up a floor, and a dynamic body (a circle) bounces around. What I'm trying to do is to increase the friction of the floor so the ball doesn't roll as much. Like the floor was grass instead of wood. I found a couple of things online, but neither seem to work. The most

On overlap, player gets stuck libgdx Rectangle

岁酱吖の 提交于 2019-12-07 23:16:03
问题 So I'm working on a collision detection code and what i do is when the user rectangle overlaps the rectangle where they cant move, I stop them from moving. So if im moving right and I hit a wall i cant move forward. This works. However if after i hit that wall, I want to move down or up form that point, I get stuck. This is how i check if the user has colidded private void checkCollision() { for (int x = 0; x < amount; x++) { if (collsionRect[x].overlaps(user)) { Gdx.app.log(ChromeGame.LOG,

Box2D - Can't destroy multiple fixtures

老子叫甜甜 提交于 2019-12-07 21:09:32
问题 I'm using box2d along with libgdx on a project I'm working on. I'm having a slight problem destroying a body/the fixtures of a body. Essentially, I want to completely destroy the body, which I do by destroying the fixtures of said body. Everything works perfectly fine with a body with one fixture, but when I use two fixtures, only one fixture get's destroyed, leaving the body intact with the other fixture. Here's two pictures to demonstrate what I mean: With both fixtures: With only one

Supporting Multiple image resolution for libgdx

一曲冷凌霜 提交于 2019-12-07 20:27:03
问题 How should I follow the directory structure and what to specify so that assetManger will use that folder for different resolution. I have studied assetManager and ResolutionFileResolver but until now I couldn't exactly figured how to specify the folder to support different resolutions. 回答1: Update : Newer versions of Libgdx use a different strategy to resolve filenames (with directories, not files), so this answer does not apply to newer Libgdx versions after (0.9.2, I think? https://github

LibGDX, OpenGL 2.0 and textures having to be powers of two?

放肆的年华 提交于 2019-12-07 20:19:28
I understand that when using OpenGL 2.0 and libGDX my texture images have to be of a power of two. This is stated on this page https://github.com/libgdx/libgdx/wiki/Textures,-textureregion-and-spritebatch . One thing that I cannot understand is that this is not always true. I am creating an app that has a splash screen and the texture that I use is loaded directly in the class declaration (the Screen) like below; private TextureRegion textureRegion = new TextureRegion( new Texture(Gdx.files.internal("images/splashLogo.png")) ); This image has dimensions of 133 x 23 which obviously are not

How do I prevent .git directory from getting copied to bin directory during rebuild?

▼魔方 西西 提交于 2019-12-07 19:10:28
问题 A .git directory keeps reappearing in my project, inside a directory that I think should be ignored. It reappears each time I clean the project or refresh it in Eclipse. The duplicated .git directory results in redundant files that prevent the project from building. I have an Android project in Eclipse that links source from a Java project, which is the way LibGDX handles a project. The .git directory that I don't want contains a file that causes a conflict, so I have to delete it every time

AdMob libGDX with Google Play services

若如初见. 提交于 2019-12-07 18:30:58
问题 Within the past few days google is forcing the use of the Google Play Services Mobile ads as the next version of android adMob. Im completely new to admob and am trying to test ads in my libGDX android game, but cant figure out how to do it because I get a rediculous amount of errors no matter what i do. I HAVE LOOKED AT OTHER EXAMPLES, but they are all for adMob 6.4.1(or earlier) which is now considered legacy. I just want an ad banner at the bottom of the screen but cant figure out how to

LibGDX Background Image in FitViewport

眉间皱痕 提交于 2019-12-07 18:17:09
问题 So, I'm using LibGDX for my upcoming App. I use a FitViewport to ensure the 16:9 aspect ratio. So players with other aspect ratios than 16:9 will have black bars at sites. What is the best way, to draw a screen filling background image, that also covers the area, where the black bars would be? camera = new OrthographicCamera(); viewport = new FitViewport(WIDTH, HEIGHT, camera); viewport.apply(); camera.position.set(WIDTH / 2, HEIGHT / 2, 0); camera.update(); Thats how I set up my camera

Is there any way to ignore libgdx images Limitation? (images must be power of two)

两盒软妹~` 提交于 2019-12-07 17:17:23
问题 In libgdx framework we can only use images power of two ( 64x256 , 128x32 , etc) Because OpenGL requires it. Is there any good way to "pass" this limitation? For example: Use images 800x480 . 回答1: Do set Texture.setEnforcePotImages(false); and you do not have the limitation anymore. So it's not true that you just can use pictures with the size power of two. It's just a "can have" not a "must have". Regards 回答2: You can use non pot textures, e.g. by using opengl es2.0. But it is good practice