Thread: 2 player RTS

  1. #16
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    incredibly true...the linear way is very bad. make a game engine. if you would like an example of one, check out my site.
    My Website

    "Circular logic is good because it is."

  2. #17
    Registered User
    Join Date
    Aug 2001
    Posts
    129
    Since my download timer shows 15minutes till DPs RTS engine is done, I would like to reprhase my previous question since noone answered it :-/

    Should I have a single function to handle both players?
    a) yes: Should I have a whole bunch of statics variables to hold the previous state of the player (since I obviously don't have any input functions in do_something())? Or is there a better way?

    b) no: Then what?


    For all of you who are cratching your head with getch() and kbhit(): go to http://www.talula.demon.co.uk/allegro/ and download Allegro (read the FAQ first about your compiler). After that it's all very easy:

    Code:
    #include <allegro.h>
    #include <stdio.h>
    
    int main()
    {
        allegro_init();
        install_keyboard();
        while(!key[KEY_ESC])
        {
             if(key[KEY_W])
                 printf("Player 1 pressed a key\n");
             if(key[KEY_UP])
                 printf("Player 2 pressed a key\n");
             rest(50);
        }
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  2. My first python project =)
    By Desolation in forum Tech Board
    Replies: 14
    Last Post: 06-26-2007, 10:52 PM
  3. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  4. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM
  5. Trying To Implement A 'Player' Class
    By adc85 in forum C++ Programming
    Replies: 2
    Last Post: 04-02-2003, 03:51 PM