Thread: Quick ? on Game design

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    317

    Quick ? on Game design

    First let me tell you generally how I have set everything up. I have created a general grafx class and derived from that my specific needs such as enemies and weapons, ect. Each of my pics is an individual object with ability to move, track, fire, (and soon rotate).

    Now my question is how do you guys implement checking for collisions? Such as each individual object checks or a general function which checks all objects?

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    now if your question is wether to check a the moving object or to check all per turn,

    i'd say just check the objects that are moving, otherwise things would get messy and slow.

    now if your question is wether or not to use a generl function for all collision or one for each, then the answer is not so simple.

    suggestions:

    if none of the objects require any special checking or if the sme code will work for all, use one.

    if one or several objects require speciality checking use one for each, maybe based off the main one that does the basic check?

    something else?
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Well, this is how I might do it:
    Have a function for the base class, which checks if there's a collision. Then declare a pure virtual function (i.e. 'onCollide()') for the base class, and overload it in the derived classes (well, you have to). So when the base collision-detect function detects a collision, it calls the derived class' onCollide() function, which does a specific task. 'course, it would be pretty slow (I heard from someone that inheritance is baaaad), but who cares?
    Just Google It. √

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  2. 20q game problems
    By Nexus-ZERO in forum C Programming
    Replies: 24
    Last Post: 12-17-2008, 05:48 PM
  3. Design suggestions: interacting with game items
    By anon in forum C++ Programming
    Replies: 3
    Last Post: 09-19-2008, 08:03 AM
  4. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  5. Im a Newbie with a graphics design problem for my simple game
    By Robert_Ingleby in forum C++ Programming
    Replies: 1
    Last Post: 11-23-2001, 06:41 PM