Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Posts posted by RussellReal

  1. there are a couple tutorials here on the site already, but TRUST ME you're going to learn ALOT better by coming up with a project you want to do.. be it something simple or silly.. get interested.. a tutorial will not keep you interested and give you a bunch of code which will just give you teh answers and will still leave you asking how most of the time...

     

    find a little project or think of a little project.. then when you need to figure out how to do something like.. get the length of a string (strlen) you browse php.net until you find a function that will do it for you.. and many times you will have some trouble finding the function.. in which case that is what forums are for.. helping you find your way :)

     

    either way, welcome aboard!

  2. function next50($page) {

      // this code assumes the xml feed will return no data when there is no more rows to update..

      // get the other 50 and fill into $xml with $page being an int

      if ($xml == null) return;

      foreach ($xml as $v) {

        // parse your XML into $id, $price, $name etc

        $products[$id] = "whatever whatever";

      }

      next50(++$page);

    }

    next50(1);

     

    note its untested, but it should work.

  3. class Player {

      public function __construct($name,$race/* Orc.. etc */,$spec/* Paladin etc */) {

        eval("\$this->name = new $name;"); // = new Orc();

        eval("\$this->name = new $spec;"); // = new Paladin();

      }

    }

     

    So that would be

    $player->Orc->berzerkerRage();

    and

    $player->Paladin->prayForAbsolution();

    to access each individual method. That wouldn't be bad, I guess, because the specific classes would still exist, AND I would only be instantiating the ones I needed.  Makes sense.

     

    What I did in my game was store class info in XML files so they could be completely modular.  I then made each ability/attack they could perform an instance of an Attack class.  A list of these attacks were then stored in my PC class.  Attacks were chosen based on the attack name - if found in the list, and if the PC had enough MP, the attack would be invoked.  Otherwise, the generic base attack (which all classes had) would be invoked.  My game didn't have various races for the player to choose from, but the same basic idea could work there, too.

     

    I had thought about this too - instantiating the attacks, which would then presumably be controlled by an interface to make sure it's got all of the appropriate methods (getViableTargets, getDamage, getDamageType, etc). That's probably a good idea in it's own right.

     

    it would be $thePlayer->race->ability();

     

    and $thePlayer->spec->ability();

  4. You don't need to make a million different classes that'd be annoying :)

     

    you could, however, instead of making the classes extensions of 1 big class you COULD simply make a few variables inside the player class

     

    class Player {

      public function __construct($name,$race/* Orc.. etc */,$spec/* Paladin etc */) {

        eval("\$this->name = new $name;"); // = new Orc();

        eval("\$this->name = new $spec;"); // = new Paladin();

      }

    }

     

    then you can go thru each object to get the special abilities or whatever, however again, you could just use classkit its awesome :)

  5. shes pretty hot, I'd hit it.. but with a database you'd be better off. You'd be able to fit way more information around the images with a database, and the database won't be looking through folders just fetching data, also paginating will be a tiny bit easier..

     

    so faster + better information capacity..

     

    What you'd want to do is keep the images whereever they are, and in the database point to those images.

  6. Yeah this site really does have lightning fast response times.. I usually answer the questions that're left open for like 10 minutes.. I type pretty slow (compared to other lightning fingered coders out there) so I just go for the ones nobody else answers. Sometimes I beat someone to a post.. but we all have our places here, that is why they call it a community. So feel welcome no matter what you do here, it makes it a better place :D

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.