|
Posted by Jace Benson on 11/16/65 11:28
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]
|