Game

This is a discussion on Game within the Game Programming forums, part of the General Programming Boards category; I'm making a text-based adventure game in which you can buy things, travel to cities, being attacked by bandits with ...

  1. #1
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312

    Game

    I'm making a text-based adventure game in which you can buy things, travel to cities, being attacked by bandits with random skill/lvl depending on your lvl. But how can I combine the skills strength, intelligence, agility and the total exp/lvl to make a kind of "damage" variable which can be used in battle? Do you guys have any ideas?
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  2. #2
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    Rather then a single damage variable each should affect certain things individually, as well as be a damage variable. Like intelligence increases the max (critical) damage you can do, agility decreases the chance of a hit being landed on you, and strength increases hp.

    As for the variable you could do it something like this
    Damage_Factor = 1.0 + Strength * 0.04 + Intelligence * 0.06 + Agility * 0.08

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    Remeber to use a class for the player and enemy. Use a constructor to implement and action the variables, General idea I used for my Flymo game:


    Code:
    class Player
    {
    public:
    Player( Hp = 100, Mp = 0, Expi = 1, Score = 0 );
    
    private:
    int m_hp;
    int m_mp;
    int m_expi;
    string m_name;
    long m_score;
    };
    
    Player::Player (Hp, Mp, Expi, Score);
    {
    hp = Hp;
    mp = Mp;
    expi = Expi;
    score = Score;
    }
    Just an idea, you do not have to use this example, but I found it effective in the game
    I made. There may be some errors in the code above but you get the general idea

  4. #4
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    I haven't learnt classes yet, I use structs instead. It works fine for me.
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  3. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 02:46 PM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

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