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
0
Question by TheBlindG · Sep 06, 2013 at 02:56 PM · guigameobjectgamecards

Beginner need some help on Card Game

Hello everyone!

I recently started using Unity to try and learn it. It went pretty well at the start, i made a little sample on 2d platform game. But now i would like to try and make an own Card-based Game. And this i have no clue on how to do. I tried to search the web for info, but couldn't find much to help me (also i'm greatly visually handicapped, so searching can be very hard for me, and that's why i ask here).

I have a little clue on how to make the deck, but only the normal deck of cards where you have 52 cards, but i wanna make my own cards and have i.e 3 of the same card in the deck.

What i've managed to do myself so far is the Top-down view i want and i have 3 different prefab cards for my deck, (wanna try it small first, before adding all cards).

So what i need help with is something that would allow me to make a deck with the cards i put into the deck, shuffle it, and then draw the cards till the deck is empty. Would be nice if the card that i draw would go to the players "hand" instead off just to the "field"

If there's someone who has a clue on how this could be done, i would very much appriciate some help!

If there's anyother video or thread that has asked this, i would appriciate a link to it, since i can't seem to find the info i need.

Also i'm using c# not javascript.

Thanks in advance

Best Regards

Marcus

P.S. Sorry for bad sentences or misspellings, can be hard to be visually handicapped.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by flaviusxvii · Sep 06, 2013 at 03:29 PM

This is actually a difficult question. It sounds like you have a good idea of which objects and components will be involved, and how they will interact.

It sounds like you might want a "Dealer" component.. with methods like shuffle(), and deal().

You probably want a "Player" component, with a List() to hold the cards in their hand.

If these terms aren't making sense, you might need some more foundational tutorial stuff, so you develop so intuition about how pieces interact, and what's possible.

Comment
Add comment · 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
0

Answer by TheBlindG · Sep 06, 2013 at 05:53 PM

I have a code that would let me add any size to the deck and a button that would let me deal 1 random card from the deck, but it doesn't work quite good. I don't really know how to implement thing into the scene that good in unity.

My script has the following methods:

ResetDeck() DealCard()

the deck is a public List deck = new List();

Don't know if that helps understading, but when i added my 3 prefabs to the deck, and tried deal out the cards just flat on a surface, only 1 card will show, but when i'm out of cards, the game restarts, but i always only see 1 card, eventhough there is 3 gameobject created when i press deal more then 1 time. It's only the first random card that will show inside the game view/scene view.

Comment
Add comment · 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

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

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Pause Menu 5 Answers

Rotation help! 1 Answer

HighScore analytics 0 Answers

Unity3D Game Time 1 Answer


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