|
Posted by Dikkie Dik on 11/16/66 11:28
First, PHP4 and PHP5 have different implementations of object oriented
functionality. Being an optimist, I am going to assume you use PHP5.
Please correct me if you are using PHP4.
What I see in your story is:
- You have sets and packs of cards. This may be just an array of card
objects, or a collection class.
- You have a "generic" card object and special implementations of it.
This suggests that the generic card is abstract, and the special(common,
uncommon, rare) cards are extensions to that. But only if they BEHAVE
differently (have extra methods or different implementations of some
methods).
Best regards
Jace Benson wrote:
> Ok I have read alot of things on zend.com, php.net and other sites went
> to the wikibooks to try to understand how to use a class. I have this
> project I want to do that I am sure would work great with a class. I
> just don't grasp the whole concept, and how to do it.
>
> I want to make a Collectable Card Game Draft Engine...(if any of you
> play VS System, LOTR, Magic: The Gathering, you know what I am talking
> about.)
>
> It would be way to complicated for just typing in regular functions and
> calling em.
>
> So this is what I've seen That I don't understand.
>
> Say i have a database with cards that are common(c), uncommon(u),
> rare(r) from 3 sets alpha(a), beta(b), unlimited(u).
>
> I need to 1st create 24 packs that contain 11commons, 3uncommons, and
> 1rare each.
>
> Bam thats a class.
>
> would it look like this?
> Class CreateDraft{
> var $set;
> var $rarity;
> function SelectRandomCard{
> //connect to database in file header
> //
> $querycardbase = "SELECT * FROM `mtg_base` WHERE rarity = $rarity
> AND set = $set LIMIT $rarity_num";//rarity and rarity_num are related
> c=11,u=3,r=1, set dictates cards available.
> $querycardbase_result6 = @mysql_query ($querycardbase);
> while ($cardbaserow = @mysql_fetch_array ($querycardbase_result)) {
>
> $packarr = $cardbaserow[card_id]
> }
> function InsertPack{
> $insertpack = "SQL STATEMENT INSERTING AN ARRAY";//I know, i know
> its late and I just want to understand.
> }
> }
>
> I guess I am asking for help.. Because I do not understand.
>
Navigation:
[Reply to this message]
|