I am trying to develop a libgdx game. i want to implement a selection screen. Till now i have implemented horizontal scrollpane and it is working fine.
Now i want to implement scrolling on the click on the button. You can check the image attached.
Asked
Active
Viewed 406 times
2

Abhinav singh
- 1,448
- 1
- 14
- 31
-
skin = new Skin(Gdx.files.internal("data/uiskin.json")); the give a error file not found exception.. – Abhinav singh Oct 28 '14 at 10:08
-
1Main problem is I do not know how to slide the popup in libgdx game.. please help me and give me answer.. – Abhinav singh Oct 28 '14 at 10:15
-
Do you have problems with skin ? have you checked : http://stackoverflow.com/questions/16182844/default-skin-libgdx – dawez Oct 28 '14 at 12:05
-
1how to translate animation in libgdx.. please help me.. – Abhinav singh Oct 29 '14 at 06:33
-
please give me answer ya suggestion. – Abhinav singh Oct 31 '14 at 12:52
-
please provide the code you write so far so can be reviewed. – dawez Oct 31 '14 at 13:08
-
I want to somthing like this... https://www.youtube.com/watch?v=D_8WSbB0WQQ – Abhinav singh Nov 12 '14 at 10:32
-
The question is not clear. Provide some code to clear what is not working . – dawez Nov 12 '14 at 10:48
-
thanks but I find the answer. – Abhinav singh Nov 12 '14 at 10:58
3 Answers
0
Try instead to use json pack
This works for me:
_skin = new Skin();
TextureAtlas buttonAtlas = new TextureAtlas("images/buttons.pack");
_skin.addRegions(buttonAtlas);
_textButtonStyle = new TextButtonStyle();
_textButtonStyle.font = _game.getFont();
_textButtonStyle.up = _skin.getDrawable("button-orange");
_textButtonStyle.down = _skin.getDrawable("button-blue");
buttons.pack:
buttons.png
size: 234,195
format: RGBA8888
filter: Nearest,Nearest
repeat: none
button-orange
rotate: false
xy: 0, 0
size: 236, 67
split: 25, 25, 14, 14
orig: 236, 67
offset: 0, 0
index: -1
button-blue
rotate: false
xy: 0, 67
size: 236, 67
split: 25, 25, 14, 14
orig: 236, 67
offset: 0, 0
index: -1
button-navy
rotate: false
xy: 0, 134
size: 236, 67
split: 25, 25, 14, 14
orig: 236, 67
offset: 0, 0
index: -1

TyM6JIep
- 406
- 8
- 23
-
this answer is clickable in the button and change the button image.. but i Want to slide the button or popup. how to sliding the image ya popup ya button.. – Abhinav singh Oct 28 '14 at 13:01
-
-
example .. any car game car can be slide to choose and play .. in the same way i want to slide the car ya popup in libgdx game .. – Abhinav singh Oct 29 '14 at 05:17
-
If I understand correctly, you need a carousel. I added two buttons on the stage (right / left) and as many pictures as necessary to show the objects. When you click in the render method, I asked in a cycle through the objects position setPosition - visually carousel was obtained. If necessary, i will gladly share the code – TyM6JIep Oct 29 '14 at 06:35
-
but when i click the button than how to slide the image.. Example any Car Racing game when choose the car, slide the screen and choose the car. My problem is how to slide the car image in libgdx. – Abhinav singh Oct 29 '14 at 06:46
-
You should add this image to the stage as an actor(yourstage.add(yourimage)). To change the position, you must use the method setPosition(yourimage.setPosition(yourX, yourY)) – TyM6JIep Oct 29 '14 at 06:49
0
Try in create method
yourImage = new Image(new Texture("images/image.png"));
stage.add(yourImage);
Try in render method
yourImage.setPosition(yourX, yourY)

TyM6JIep
- 406
- 8
- 23
-
thanks but this is not my problem solution. my problem is how to slide ya translate animation in the image in LibGDX click the buttion. – Abhinav singh Oct 29 '14 at 09:35
-
Look here(https://github.com/libgdx/libgdx/tree/master/tests/gdx-tests/src/com/badlogic/gdx/tests), maybe find something worthwhile – TyM6JIep Oct 30 '14 at 12:34
0
for the answer look this link https://github.com/krustnic/HorizontalSlidingPane

Abhinav singh
- 1,448
- 1
- 14
- 31