0
votes

I am a complete new user to libgdx and am looking to use it to write a simple card game.

I want to be able to flip my cards over to reveal them, in the same way as this example from Google shows.

http://developer.android.com/training/animation/cardflip.html

However, my game is only 2D so i can't find a command that will do this. I've found a suggestion on stack overflow which might work, but i don't think it will give a sense of perspective/depth when the card is turned.

Libgdx rotate an actor on its Y axis

Am i going to have to somehow use a 3D library for this part of the game? It seems a bit overkill. Or is it possible to combine some part of the android SDK animation code within a libgdx game?

2

2 Answers

0
votes

There are ways to combine parts of android sdk code within a libgdx game, but you would lose platform independence (you can't test it on desktop except emulator).


Using a 3D library is not an overkill at all and is really easy to implement in libgdx.

Have a look at Decals. 2D actors in a 3D world. I suppose that is exactly what you need.

Good luck.

0
votes

Decrement the sprite's size to zero and move it to the right at 1/2 of the speed it is shrinking. When the card has disappeared, change the sprite and do the same process backwards.