libgdx

Making a Group hide Actors outside of its bounds

我们两清 提交于 2019-12-01 05:52:33
I have created a very simple plot that is dynamically updated by adding new images on the right side of the screen, and then making them move towards the left side. This way, the plot within the screen's bounds looks like they are plotted as time goes by. Unfortunately, when doing it this way, I have to let the images start outside of the screen, and move into view, and I can't remove them again before they are completely outside of the screen on the left side. This results in the images being partially visible outside of the screen's bounds. The control is created as a Group that contains two

libGDX get pixel color from sprite or texture

荒凉一梦 提交于 2019-12-01 05:31:02
问题 I was searching it on net but i wasn't able to find any solution. I have a sprite or a texture and when i touch it i want to get pixel color from touch coordinates. so I have: if (Gdx.input.isTouched()) { Rectangle spriteBounds = sprite.getBoundingRectangle(); if (sprite.contains(Gdx.input.getX(), Gdx.input.getY())) { //and here something like //Color color = sprite.getPixelColor(Gdx.input.getX(), Gdx.input.getY()); } } Is it possible? Thank you :) 回答1: Something like the following might work

libgdx: best way to load all assets in the game

六月ゝ 毕业季﹏ 提交于 2019-12-01 05:18:30
问题 In my play screen has a lot of textures Texture , fonts FreeType , images scene2d.Image and buttons scene2d.Button . So, when I set play screen ((Game) Gdx.app.getApplicationListener()).setScreen(new PlayScreen()); it takes a few seconds to open the screen. I want to open it quickly, What is the best way to achieve that? Do I create a new class to create all assets then load them on the screens? 回答1: You should use the AssetManager. The manager allows you to load your assets when you start

MouseJointDef libgdx - draw a trajectory line like Angry Birds

倾然丶 夕夏残阳落幕 提交于 2019-12-01 05:07:06
问题 in libgdx game I want to touchDown and then drag somewhere and then on the release (touchUp) apply a directional force based on the distance and direction from the target body. When you touchdown the target body stays still and then on touchup the force is applied along the desired trajectory. (very similar to Angry birds - where you get to see the trajectory in dotted lines for the target body when you hold hack the slingshot - I want to do the same) So I guess that this might not be the

libGDX Exception in thread “LWJGL Application”

妖精的绣舞 提交于 2019-12-01 04:27:47
问题 I've been following the setup tutorial found at: libGDX setup tutorial. I'm not sure what's going on here. I can finally get the project to deploy in the emulator, however, the desktop version is not quite working. I've grabbed a copy of both gdx-backend-jogl.jar as well as the native jogl and it still seems to give the same error. I've i have viewed the following thread and thought i could just copy the jogl jar files from the libgdx nightly latest folder into the libs folder within the my

LibGDX: Particle scale

妖精的绣舞 提交于 2019-12-01 04:27:23
问题 In my game I use static final float FRUSTUM_WIDTH = 10; static final float FRUSTUM_HEIGHT = 15; So when I draw the particles they take the whole screen and are huge! So how do I scale them down to fit my needs? //Pew Labs 回答1: Either you use the particle editor (to be honest I don't think it's a good idea for sizing the particles, as you mentioned the particles won't get too small (for anything else I really recommend it)) or you just open the particle effect file. It should be generated by

Delta value in render method libgdx

我只是一个虾纸丫 提交于 2019-12-01 04:02:12
I have check delta value in render method in Screen class.. I saw it is not constant. Can any body tell where it come from and what it is? And does it differ in different screen sizes? If it is so how can we overcome this? I am asking this cause my player jump depends upon delta time and sometimes it jumps too high ..... The deltaTime has nothing to do with screen sizes. It is the amount of time the last frame took to be rendered. Rendered in case of LibGDX also includes all the logic you execute in your render() method. Usually you want a game to run at the same speed on different devices. If

libgdx texture filters and mipmap

荒凉一梦 提交于 2019-12-01 03:59:38
When I try to use mipmap filtering in LibGDX, none of the images appear. I'm new to LibGDX, and I have a simple 2d scene with three rotating, scaled circles. In order to anti-alias them, I wanted to use linear filtering. For advice, I looked to this article ,which said that, for heavily scaled images, a mipmap can be used to improve speed or quality. The first unexpected appearance was that, despite the fact that all of my images were scaled down, I would only see a linear filter if the magFilter was linear. In other words: This code will show a linear filter for minified images: parentTexture

Getting Stage coordinates of Actor in Table in libGDX

旧巷老猫 提交于 2019-12-01 03:48:51
I want to create a floating help bubble to introduce the basic functioning of my game. This bubble should float above the Actor I want it to explain, like shown in the picture below. To accomplish this, I want the coordinates of the Actor, in this case the left button, and then I can add the bubble Actor to the Stage in front of everything else. The last part is easy enough, but I'm struggling with retrieving the actual coordinates of the button, as it is in a table. The two buttons are added to a Table like this: t.add(btnLab).expandX().center(); t.add(btnSea).expandX().center(); I've tried

Delta value in render method libgdx

好久不见. 提交于 2019-12-01 02:29:03
问题 I have check delta value in render method in Screen class.. I saw it is not constant. Can any body tell where it come from and what it is? And does it differ in different screen sizes? If it is so how can we overcome this? I am asking this cause my player jump depends upon delta time and sometimes it jumps too high ..... 回答1: The deltaTime has nothing to do with screen sizes. It is the amount of time the last frame took to be rendered. Rendered in case of LibGDX also includes all the logic