4 Replies - 17150 Views - Last Post: 01 April 2012 - 10:31 AM Rate Topic: -----

#1 Ace_TheDeveloper   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 01-April 12

Trading Card Game

Posted 01 April 2012 - 07:25 AM

Hello there! I am newbie in C# and in programming too. I like playing Duel Masters and so I decided to make dueling software called DMC (Duel Masters Civilization). Duel Masters is a trading card game nearly like Magic the Gathering but in Duel Masters both players have 5 shields and whoever destroy all of opponent's shields and then make final attack on opponent will win. Duel Masters have mana system too like Magic and ofcourse deck, graveyard and battlezone. Now, the reason for creating this topic is;

1- I just want some ideas on how should I make battlezone, manazone, graveyard, deck and hand zone. I am not asking for codes, I just need some suggestions/ideas how to make this zones as I am new in C# and I dont have much experience. What should I do to divide battlezone into two, one for 1st player another for 2nd player and both player can see it so they both know which creature/monster has been summoned or which spell has been casted?

2-How to tap/untap cards like used mana will tap automatically, attacking creature will tap. For this I may need some coding cause I dont have any idea for it neither do I know its syntax. Its something which is beyond my thinking, how would a card/image will go in tap position? Should I use some reversing logic like we do in string case?

3-I have constructed deck building but I need images and card details to show too to the user. Any idea?

I HAVE USED LISTBOXES AND HERE IS IMAGE AND CODING OF MY DECK CONSTRUCTION:

IMAGE:
//http://imageshack.us/photo/my-images/88/1213if.jpg
CODING:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace TCG_Main
{
    public partial class Deck : Form
    {
        public Deck()
        {
            InitializeComponent();
        }
        
        private void addcard_Click(object sender, EventArgs e)
        {   
            if (listBox1.SelectedIndex >= 0)
                listBox2.Sorted = true;
            if (listBox2.Items.Count < 40)    
            listBox2.Items.Add(listBox1.SelectedItem);    
            else MessageBox.Show("You have reached the 40 cards deck limit");  
        }

        private void removecard_Click(object sender, EventArgs e)
        {                        
            if (listBox2.SelectedIndex >= 0)
                listBox2.Items.RemoveAt(listBox2.SelectedIndex);   
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            listBox1.Sorted = true;
        }

        private void Save_Click(object sender, EventArgs e)
        {
            StreamWriter Write;
            SaveFileDialog Open = new SaveFileDialog();
            try
            {
                Open.Filter = ("Deck File|*.deck|All Files|*.*");
                Open.ShowDialog();
                Write = new StreamWriter(Open.FileName);
                for (int I = 0; I < listBox2.Items.Count; I++)
                {
                    Write.WriteLine(Convert.ToString(listBox2.Items[I]));
                }
                Write.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }   
        }

        private void Load_Click(object sender, EventArgs e)
        {
            {
this.listBox2.Items.Clear();
OpenFileDialog Open = new OpenFileDialog();
Open.Filter = "Deck File|*.deck|All Files|*.*";
try
{
Open.ShowDialog();
StreamReader Import = new StreamReader(Convert.ToString(Open.FileName));
while (Import.Peek() >= 0)
listBox2.Items.Add(Convert.ToString(Import.ReadLine()));
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex.Message));
return;
}
} 
        }

        private void clear_Click(object sender, EventArgs e)
        {
            this.listBox2.Items.Clear();
        }
    }
 }



There are only 6 card names which I used in this but dont think it is enough there are more which I will add later after learning the method how to add images and card details and link it with these name so when user clicked it he can see its image and detail and can add it into his deck.

Is This A Good Question/Topic? 0
  • +

Replies To: Trading Card Game

#2 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Trading Card Game

Posted 01 April 2012 - 08:23 AM

I would suggest you need to work more on separating data from GUI.
You 'deck' shouldn't consist of much more than a collection of 'card' objects and the methods to manage the cards. There is NO reason a deck should have ListBoxes or other GUI elements.

You really should get out of the habit of the CIS101 names: Listbox1, listbox2, I, J etc. They just make your life hard. lbUsedCard and lbAvailableCards are a lot easier to work with for example.

It looks like your saving your deck in a text file. I might recommend XML serialization instead. It is more robust and won't require near as much micro-management every time you change the structure of one of your classes.
Separating data from GUI - PLUS - serializing the data to XML


I think you need to work more on understanding objects. Let the individual classes take care of themselves instead of your program trying to handle all the little details.
Class/object example:
Spoiler


Personally I think trying to build a game like this is a bit ambitious without learning more of the basics. But that works for some people. FAQ 24 probably applies here. (Click the SHOW button below)


TOP most asked:


What does this error message mean?

FAQ 2: How do I debug
FAQ 3: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated Mar 2012
Spoiler



Was This Post Helpful? 0
  • +
  • -

#3 Ace_TheDeveloper   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 01-April 12

Re: Trading Card Game

Posted 01 April 2012 - 09:53 AM

What about my first and second points? Ok let me tell you everything. Actually there is one dueling software DMC 2.4, we all used to play on that but now we need more cards to add in it and to update some its feature too but our developer is no more with us. Now I am thinking to make DMC version 2.5 on C# and I have just learned little bit C# by watching tutorials and by google. None of us have DMC source code so I have to start it for the scratch. Here is the image of the DMC I want to make my software like that.

http://imageshack.us...5/12312313.jpg/

When user click on card he can see image and can see card's detail and then after creating deck he can use it and can play with it.

He is the picture of play game scene.....

http://img543.images.../4743/1131l.jpg

I want to make something like this. I am new.
Was This Post Helpful? 0
  • +
  • -

#4 Ace_TheDeveloper   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 01-April 12

Re: Trading Card Game

Posted 01 April 2012 - 10:28 AM

one more thing I forgot to mention before, http://img543.images.../4743/1131l.jpg

in this screenshot there is blue card image instead of real cards images cause I haven't install card images yet.
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Trading Card Game

Posted 01 April 2012 - 10:31 AM

Quote

there is one dueling software DMC 2.4,
I am thinking to make DMC version 2.5 on C#
None of us have DMC source code so I have to start it for the scratch.


Then you aren't making version 2.5 of anything. If you aren't the developer of the 2.4 version you shouldn't try to make your software appear to be theirs. Just make your own version 1 with a new name.

Quote

What about my first and second points?
1- I just want some ideas on how should I make battlezone, manazone, graveyard, deck and hand zone.

I don't care what names you use in your games... They're all gibberish to someone that doesn't play this stuff. Call them battlesone or widgets it doesn't matter. They are still objects and that advice and links have already been given.

Quote

2-How to tap/untap cards l

I'm thinking click on it with the mouse.


Quote

I want to make something like this. I am new.

Q: I've never built a building before, not even a dog house. But I was thinking I'd learn by building a 10 story office building. Where do I start?

Did I make my point yet?

You need to start by not trying to develop this game. You don't have the experience. You need to learn the language first. Work your way through a couple books from cover to cover. Then develop smaller stuff, working up to the big stuff. Learn to crawl before trying to run with scissors.

For example, just one aspect of the screen shots you showed was some client/server chatting between players. It might be wise to learn how to build a simple chat program: JUST a chat program and make it work with multiple subscribers.

You need to learn a lot of foundation concepts before taking on this game. One of which is object oriented coding. Until you can separate your logic from the GUI you have no hope of building this.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1