General Question

This is a discussion on General Question within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Hello all out there Heres somethig that Ive always been wondering about. Lets take a simple pac man game. How ...

  1. #1
    Patent Pending GSLR's Avatar
    Join Date
    Sep 2001
    Posts
    134

    General Question

    Hello all out there

    Heres somethig that Ive always been wondering about.

    Lets take a simple pac man game.

    How does the pac man know when it has been killed or when a collision has taken place.

    Im not trying to write a game here but i have always wondered how the detection of collisions etc in the game are picked up by the moving parts as everything is moving at once so how does one know that something has collided.

    If you can help in a small explanation thanx

    GSLR
    And To All Those Opposed, WELL !!!
    >Deleted< " Looks like a serial no."

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    in most games there's a loop that keeps repeating, updating the game. it happens very frequently. during one of those updates, the program checks to see if the two objects violate each other's boundaries.

  3. #3
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    In games, each sprite or game object generally has a bounding area, like a rectangle in a 2-D game. The game logic checks to see if any bounding areas intersect (collide) with each other and perform the appropriate action. Collision detection systems can get very involved however and generally involve physics equations and lots of math (especially for 3D).
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  4. #4
    Patent Pending GSLR's Avatar
    Join Date
    Sep 2001
    Posts
    134

    thanks

    thanxs for the info
    And To All Those Opposed, WELL !!!
    >Deleted< " Looks like a serial no."

  5. #5
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    For 2D stuff, it's not really that bad though, espcially if you don't let the character rest between tiles. You can simply keep a matrix of information that stores whether or not a particular spot is passable, and everytime the character moves, check if the tile it wants to move into is going to move into a tile that is passable.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A general question aout programming?
    By bradt93 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-26-2008, 11:00 AM
  2. winsock - general question
    By keira in forum Windows Programming
    Replies: 1
    Last Post: 09-28-2007, 01:56 PM
  3. another exercise question
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 11-28-2005, 02:52 PM
  4. general programming compatability question
    By Metarectilinear in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 10-25-2002, 11:51 PM
  5. general question regarding a function parameter
    By mlupo in forum C Programming
    Replies: 7
    Last Post: 10-13-2002, 07:32 PM

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