Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: P6: OO Wizard Game (RPG kinda, sorta)

by dragonchild (Archbishop)
on May 13, 2005 at 02:25 UTC ( [id://456589]=note: print w/replies, xml ) Need Help??


in reply to P6: OO Wizard Game (RPG kinda, sorta)

I haven't kept up with Pugs OO (cause cygwin sucks rocks), but can't you create a base class for Person and Monster? Something along the lines of:
class Baseclass { has Int $.life is rw; has Weapon $.weapon is rw; method hit (Int $power) { $.life -= $power; }; method dead () { $.life <= 0 }; method attack() { $.weapon.damage } } class Monster is Baseclass { }; class Person is Baseclass { };

Where $.weapon is the active weapon and the rest stay in the inventory.

Also, note the variable types. :-)


  • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
  • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"

Replies are listed 'Best First'.
Re^2: P6: OO Wizard Game (RPG kinda, sorta)
by eric256 (Parson) on May 13, 2005 at 02:30 UTC

    I'm fairly certain that inheritance isn't implemented yet. As soon as it is or at least i find out it is or get a minute to check i will be updating it.


    ___________
    Eric Hodges
Re^2: P6: OO Wizard Game (RPG kinda, sorta)
by broquaint (Abbot) on May 13, 2005 at 13:22 UTC
    I haven't kept up with Pugs OO (cause cygwin sucks rocks)
    If you're running Windows you can still check out Pugs without the help of Cygwin - all you need is GHC 6.4, Perl (not sure the lower version limit) and nmake. If you also want Rules support you'll also need Parrot, which can be slightly trickier to compile, depending on your setup.
    HTH

    _________
    broquaint

      Cool thanks for the info, that will be useful for me too, i am on windows :)
      rpg game

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://456589]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found