Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2008
    Posts
    2

    Evil Monkeys have killed my collision code!

    Okay, I was following the example. For some reason, my collision code for my spriteClass works 90% of the time. Sometime it clears a certain tile.

    Code:
    bool spriteClass::isValidMove(int x, int y)
    {
    	if(level->level[x][y] == TILE_WALL)
    		return false;
    
    	list <spriteClass *>::iterator iter;
    
    	for(iter = level->spriteList.begin(); iter != level->spriteList.end(); iter++)
    		if((*iter) != this && (*iter)->getX() == x && (*iter)->getY() == y)
    			return false;
    
    	return true;
    }

  2. #2
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Then I might question more the calling of that function, rather than the function itself. As that function seems reasonably clear and consise, I dont see (off the top of my head) an issue with that code.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  3. #3
    Join Date
    Aug 2004
    Location
    little rock arkansas
    Posts
    3,482

    Talking

    Have you Checked the Thread of Information?
    I think it had some wall collision code
    ME WANT AGENTS ME WANT AGENTS ME WANT AGENTS

  4. #4
    Join Date
    Dec 2008
    Posts
    2
    Wall collision works, it's just the AI- Oh. It's the AI's side?!

  5. #5
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    sounds like it :P
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •