libgdx

how I check collision with box2dlights in libgdx?

落爺英雄遲暮 提交于 2019-12-11 22:01:55
问题 It is possible to detect when a body is under light? ( Collision with the light and a body ) How I check this with libgdx? Sorry for my english... 回答1: It could be easy to implements with raycasting : With a point light, you have to perform a raycast from your body object to the light object, if the first returned body is the light then your object is under light. With a directional (infinite) light you have to raycast from your object body toward light direction opposite, if raycast not

An odd, cryptic error from libgdx's version of box2d involving a mousejoint

对着背影说爱祢 提交于 2019-12-11 21:15:06
问题 Code There is my code for my Screen object. The garble of arrays and Vector2 s at the bottom is just a long list of models for the cats. My goal is to make a port of http://catsinspace.co.nf, my website, to learn how to use libgdx and its box2d port. I am trying to get the mousejoint working, but I apparently don't understand how a groundBody is supposed to work, despite my hours of googling. Here is my strange, cryptic error that I have tried googling fruitlessly: AL lib: alc_cleanup: 1

Create pixmap circle with smooth border

末鹿安然 提交于 2019-12-11 19:43:39
问题 How can i draw a circle with a smooth border on a pixmap? The normal "sample" parameter in the config doesn't affect a pixmap. EDIT: Pixmap ds = new Pixmap(width,height, Pixmap.Format.RGBA8888); ds.setColor(color); ds.fillCircle(ds.getWidth()/2, ds.getWidth()/2, (ds.getWidth()-20)/2); texture = new Texture(ds); ds.dispose(); The circle has a 200px radius. A normal circle-shape created with the shaperenderer produces a perfectly smooth circle... 回答1: The problem you have with the pixmap circle

Launch Android Intent from Libgdx render method

断了今生、忘了曾经 提交于 2019-12-11 19:22:41
问题 I'm trying to launch an Intent from the render method in libgdx but I am getting a "Can't create handler inside thread that has not called Looper.prepare()" error. I have implemented the Interface from here http://code.google.com/p/libgdx-users/wiki/IntegratingAndroidNativeUiElements3TierProjectSetup I have used the Toast implementaion and that works okay. This is my Android implementation @Override public void launchPlayerRoom() { Intent intent = new Intent(appContext, RoomViewActivity.class

libgdx on ios GdxRuntimeException couldn't load file

不羁岁月 提交于 2019-12-11 19:19:31
问题 I decided to move my application from Android to iOS. Application use libgdx library. I generated ios subproject using libgdx and opened it using Xamarin Studio. All images are linked from my-project-android/assets/data. All images have set build Action > content. Now every time when run project from xamarin studio i get GdxRuntimeException Coldn't load file: data/background.png. This file is the first image which i load in my application. All operation i have done on my mac both with

LibGDX persist actors while switching screens?

一世执手 提交于 2019-12-11 19:04:04
问题 I'm making a game in LibGDX and I have a couple of menu screens using the scene2d ui. I have one MenuBaseScreen super class that sets up the default actors required for each screen. Then i have a MainMenu, Options etc screens that each inherit from MenuBaseScreen. In each of the screens there is a parallax background that keeps going from right to left. This parallax background gets instantiated in the MenuBaseScreen. Now the problem with this is that each time I switch screen there is a

Some audios of my libgdx game doesn't load in android but it does en desktop

微笑、不失礼 提交于 2019-12-11 18:41:45
问题 I have every audio in my asset folder, they are .ogg and I load them by the asset manager, but sometimes that I install the apk on my android, it throws me an error message: E/ExtMediaPlayer-JNI: env->IsInstanceOf fails E/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 E/ExtMediaPlayer-JNI: env->IsInstanceOf fails E/MediaPlayer-JNI: JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 D/MediaPlayer: setSubtitleAnchor in MediaPlayer D/MediaPlayer: setSubtitleAnchor in MediaPlayer

Libgdx - Slowing Projectile to stop, then Reversing it

假装没事ソ 提交于 2019-12-11 17:54:43
问题 When working with creating games in Libgdx, I have not been using the physics engine as I dont have too many moving parts in the game. So, to have objects fall from the top of the screen to the bottom, I used what the documentation had, something like this: projectile.y -= 200 * Gdx.graphics.getDeltaTime(); That example will make said projectile go down at 200 pixels per second (I believe). What I am trying to do is make it so after two seconds, the projectile will transition from negative

Libgdx: More than one file was found with OS independent path 'libgdx-freetype.dylib'

混江龙づ霸主 提交于 2019-12-11 17:53:34
问题 Hello fellow Programmers, I’m having trouble building my libgdx Game for Android with freetype font dependencies. Libgdx version: 1.9.8 Gradle version: 3.2.0 Android Studio version: 3.1.4 Even without any dependencies for freetype font declared in the root build.gradle file and cleaning of the project I get the following Error when trying to build for Android: Execution failed for task ':android:transformResourcesWithMergeJavaResForDebug'. More than one file was found with OS independent path

Get Selected Item from List

妖精的绣舞 提交于 2019-12-11 17:38:59
问题 I'm currently creating an inventory system, in which the user will select an item from a list and the icon on the right will update based on the item that the user has picked. I need a way to get the list item that the user has currently selected. I then need to use that list item to display an icon which the user will see. Currently I have tried using the getSelected() method on the inventory list, which seems to be only returning the first item in the list. I need a way to get the item that