Reusable skill class structure

Posted by Martino Wullems on Game Development See other posts from Game Development or by Martino Wullems
Published on 2011-02-24T21:59:28Z Indexed on 2011/02/24 23:34 UTC
Read the original article Hit count: 320

Hello,

Pretty new to the whole game development scene, but I have experience in other branches of programming. Anyway, I was wondering what methods are used to implement a skill structure. I imagine a skill in itself would a class. I'm using actionscript 3 for this project btw.

    public class Skill
{
    public var power:int;
    public var delay:int;
    public var cooldown:int;

    public function Attack(user:Mob, target:Mob) 
    {

    }

    }

}

Each skill would extend the Skill class and add it's own functionality.

    public class Tackle extends Skill
{

    public function Tackle(user:Mob, target:Mob) 
    {
        super(user, target);
        executeAttack();
    }

    private function executeAttack():void 
    {
        //multiply user.strength with power etc
        //play attack animation
    }

}

}

This where I get stuck. How do I termine which mobs has which skills? And which skill will they later be able to retrieve (by reaching a certain level etc). How does the player actually execute the skill and how is it determine if it hits. It's all very new to me so I have no idea where to begin. Any links would also be appreciated. Thanks in advance.

© Game Development or respective owner

Related posts about actionscript-3

Related posts about design-patterns