two sided card that changes when flips

Hello guys!

I’m new to unity, and I want to make a simple card game.
There is a card that flips on click, but on every click the card side changes to a shape (like: circle, triangle, square).
My question is how I can define such a card? My idea is creating a sprite. and when I click on the sprite, it flips 180 degree. and on the degree 90, I change the sprite.

I don’t know if there is a better way for that. When I Googled, there was something about prefabs.

Any Help would be appreciated. Thanks in advance.

I assume since you are talking about sprites you want this to be a 2D game?

I’d say that since you’d want to change the actual shape of it and not just the image, changing at 90 degree is your best bet if you want to make the transition invisible.

I do suggest that you learn about Prefabs if you don’t know anything about it, as it’s the very core of most games, especially a card game. I promise you’ll find tons of tutorials and more about the topic elsewhere so I’m not going to explain it here, but trust me you’ll need it.

As for your problem I’d say just make an animation to rotate it 90 degrees, then in code just check for the animation to be complete and swap the sprite and play another animation that rotates another 90 degeees. (or you can just do it all in code and skip animations with something like Transform.Rotate)

If that doesn’t give you the desired effect, let me know :slight_smile: