- Home /
Some questions regarding card game
Greetings, I'm trying to make a small card game and I have some questions:
1) I've made a prefab of a blank card, and I want to fill it with text for several cards, whats the best approach? Creating every card png? Or having a script attached to the card that changes every attribute I wanted? and If so, how would I write the text over image?
2) Whats the best approach to make a card db?
Thanks in advance
Answer by GoCatGoGamesLLC · Dec 28, 2013 at 03:28 PM
Greetings back atcha!
Ask ten programmers/designers/people for the "best approach" will likely get you eleven answers. Here are mine!
I like relational databases. Your "card" will likely be made up of several elements (correct me if I'm wrong, please), like a Title/Name, an image or bacground, some text, maybe even some integral variables that show current health or attack or something. All of these can be tracked many ways, but I would suggest a database that will allow you to get all of these parts and apply them to the default prefab instance of a card in Unity.
Prefab is basically "Blank" and, at instantiation, gets its attributes applied via the database ID/primary key.
This, by my reckoning, will give you the best way to simulate finite decks and random draws.
for the prefabs database, should I use C#+Sqlite? or is there a better way?
unfortunately i am not sure there is a database in unity, please correct me if i am wrong i tend to create objects and hardcode a lot of data
yeah I've found a way of using mysql, didnt tested it though. Without a database, creating an instance of several cards and filling the attributes for each one might also work and maybe would be faster for now :x
There are a few implementations on the Asset Store for SQLite -- not sure if you want to lay out ca$h, though. X$$anonymous$$L files can do the trick and offer some post-build customization. You'll need to add using System.Xml and using System.IO to your script to access the X$$anonymous$$L features of C#.
Can I use the X$$anonymous$$L/Json coding through javascript and ajax like I usually do in my javascripting on php?
Answer by Owen-Reynolds · Dec 28, 2013 at 03:17 PM
The standard 3DText gameObject (in code called a TextMesh) does a nice job of putting text on something in the game world. Can display arbitrary strings, but no internal format changes (like bolding one word.) Lots of questions/answers about it here (like see-through-ness and multiple lines.)
Your answer
Follow this Question
Related Questions
How can I get game data from a specified file? 0 Answers
Trading Card Game 5 Answers
How to Place and arrange 3D cards using Grid and Bounds 0 Answers
Card Game like yu-gi-oh 1 Answer
Print char to a 2D image? 1 Answer