Thread: First Windows game, FINALLY DONE!

  1. #31
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Thats good randomising is fairly easy to put in. In case you're interested, this is what I know about generating random numbers:

    use this to seed the random number generator at the beginning of the program
    #include <time.h>

    Or if you are making a Windows app, you can use

    use this to get just any random number

    To get a random number from "start" to "end", do this:
    int start = 5;
    int end = 10;
    int randomNumber = (rand() % (end - start + 1)) + start;

    To make it easier, make a macro:
    #define RANDOM(start,end) ((rand() % ((end) - (start) + 1)) + (start))
    Hope it helps
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #32
    Registered User Kirdra's Avatar
    Join Date
    Aug 2002
    Yea thanks, I am using a lot of random numbers for rare items and Enemy/Player attack damage. I've got the random thing worked out now. That clears it up at bit.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need book to program game into multiplayer...
    By edomingox in forum Game Programming
    Replies: 3
    Last Post: 10-02-2008, 09:26 AM
  2. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  3. Game Designer vs Game Programmer
    By the dead tree in forum Game Programming
    Replies: 8
    Last Post: 04-28-2005, 09:17 PM
  4. Tricks of the windows game programming gurus
    By Nutshell in forum Game Programming
    Replies: 0
    Last Post: 04-24-2003, 11:37 PM
  5. finished my game, finally
    By agerealm in forum Game Programming
    Replies: 15
    Last Post: 10-12-2001, 08:01 AM