Thread: Okay, game is ALMOST complete, but i need an AI

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    Okay, game is ALMOST complete, but i need an AI

    Okay, I am making a text game and it's kinda like myst, if you have a sword the wolf doesn't kill you. Else, your dead, Fred. But i want people and thing to move around. If i define a class like this:

    class skeliton{
    PUBLIC:
    int skel_pos_X = 8;
    int skel_pos_Y = 17;
    int max_attack = 10;
    int min_attack = 2;
    }

    how would i make him move at random and attack at random?

    Plus, how can i make an inventory? One that allows the use or dropping of the item?

    my code for item positions is this:
    Code:
    if (player_location_X == 7 && player_location_Y == 5)
    {
        if (bread = 1)
        {
        cout << "Loaf of bread\n";
        }
    }
    This war, like the next war, is a war to end war.

  2. #2
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    one possiblity is that you have code for the enemy running on a different thread. Then you can make the thread randomly, sleep or attack or move.

  3. #3
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    That was bad
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  4. #4
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    What would the code look like?
    This war, like the next war, is a war to end war.

  5. #5
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    Originally posted by abrege
    That was bad
    What was bad?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating an AI engine for a simple game
    By cyb3r in forum Game Programming
    Replies: 1
    Last Post: 01-26-2009, 01:19 PM
  2. 2D Game project requires extra C++ programmers, new or experienced
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 05-16-2007, 10:46 AM
  3. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  4. Maze game, complete with maze editor and an example maze!
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-20-2002, 03:27 AM
  5. Yay! My first game is complete! Come look!
    By Leeman_s in forum Game Programming
    Replies: 2
    Last Post: 11-05-2001, 10:23 PM