is this how to do this...

This is a discussion on is this how to do this... within the Game Programming forums, part of the General Programming Boards category; Hi, im currently coding my first small fighting game and im just wondering if a struct would be right for ...

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    132

    is this how to do this...

    Hi, im currently coding my first small fighting game and im just wondering if a struct would be right for a moveset that can do more damage depending on the health...

    like...

    Code:
    struct DragonMovesSet {
                       char MoveName[15];
                       int MoveDmg, MoveStam, MoveAc;
    }
    BigKick={ "Big Kick", 11, 8, 9 };
    struct DragonMoveSet SpinningKick={ "Spinning Kick", 9, 12, 7};
    struct DragonMoveSet ElbowToHead={ "Elbow To The Head", 4, 5,7};
    struct DragonMoveSet Headbutt={ "Headbutt", 6, 9, 11};
    and then like, another struct...

    Code:
    struct DragonMovesSetSrong {
                       char MoveName[15];
                       int MoveDmg, MoveStam, MoveAc;
    }
    BigKick={ "Big Kick", 14, 8, 12 };
    struct DragonMoveSet SpinningKick={ "Spinning Kick", 11, 12, 9};
    struct DragonMoveSet ElbowToHead={ "Elbow To The Head", 6, 5,9};
    struct DragonMoveSet Headbutt={ "Headbutt", 9, 9, 14};
    and you only use moves from the second one when opponent is below 60 hp.. etc...

    is this how you would do it? and obviously the functions and stuff.

    plz let me know. hugo.

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    if you're only changing the values, you can use the same struct definition.
    Code:
    typedef struct _tMove
    {
      char MoveName[15];
      int MoveDmg, MoveStam, MoveAc;
    } Move;
    
    Move DragonSpinningKick  = { "Spinning Kick", 9, 12, 7};
    Move DragonSpinningKickStrong  = { "Spinning Kick", 11, 12, 9};

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    132
    ok thanks. ill look into it.

    hugo.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21