Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by rezam · Apr 08, 2015 at 03:12 AM · spritescript.card

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
3

Answer by winsjansen · Apr 08, 2015 at 09:23 AM

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 :)

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rezam · Apr 08, 2015 at 10:36 AM 0
Share

Tanks a lot. And Yes, it is a 2D game. I think I'll have an empty card as a sprite, and import other cards with shapes on them as textures. then I change the empty card sprite's texture. right?

avatar image winsjansen · Apr 08, 2015 at 11:30 AM 1
Share

Yes, thats at least how I'd do it, let me know if you run into any problems and I'll try my best to continue to help out!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to double spirte/gameobject/prefab and control the result on those items? 0 Answers

2D Animation Won't Allow Player To Move 0 Answers

How create a audience style game Rocksmith 1 Answer

Canvas image sprite change from script 0 Answers

Can I get the Cell X,Y from a sprite from a multi spritesheet? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges