Thread: Pacman-style Maze Collision Detection

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Question Pacman-style Maze Collision Detection

    Hello,

    While this site was down, I did something rather silly:- tried to make a game in DOS assembly language. Worse still, I have practically no experience in assembly language programming...

    Nevertheless, I managed to get some double-buffering going, drew a maze to the back buffer and got a object moving with the cursor keys. Unfortunately, the detection of where the object is in the maze seems to be a bit messed up, as when you want to turn through a hole in a wall, it doesn't go until it's a tile past it, then you lose control completely and it just flies off the screen.

    I've taken the liberty of expanding what code I'd written into Windows C so you people could digest what's going on without scratching your head at Intel instructions. The code is attached.

    Can anyone help me with this?

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    DOS assembly language eh. What's that. I know about x86 assembly language but no DOS assembly.

    Just kidding, I know what you mean but assembly is not related to DOS at all.

    Seems that your one tile off in your sprite's or something. Shouldn't be too hard to fix.

  3. #3
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Originally posted by Bubba
    DOS assembly language eh. What's that. I know about x86 assembly language but no DOS assembly.

    Just kidding, I know what you mean but assembly is not related to DOS at all.
    I know, but the BIOS doesn't give you Interrupt 21h, DOS does, so it won't work without DOS or DOS-compatible OS.

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    I second bubba your sprites are off i think.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    try this:

    Code:
    int sprite_center_x=sprite_x+half_imagewidth_x;
    int sprite_center_y=sprite_y+half_imageheight_y;
    
    TestForHit(sprite_center_x,sprite_center_y);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Collision Detection Problems
    By Dark_Phoenix in forum Game Programming
    Replies: 1
    Last Post: 12-17-2006, 03:25 PM
  2. breakout style game collision detection
    By m00se123 in forum Game Programming
    Replies: 6
    Last Post: 10-31-2002, 09:18 AM
  3. bounding box collision detection
    By DavidP in forum Game Programming
    Replies: 7
    Last Post: 07-07-2002, 11:43 PM
  4. collision detection
    By DavidP in forum Game Programming
    Replies: 2
    Last Post: 05-11-2002, 01:31 PM
  5. Replies: 4
    Last Post: 05-03-2002, 09:40 PM