//아이템상자
 if(item.Box.rife==TRUE)
 {
  item.Box.rect.left=myChar.getScrX()+100;
  item.Box.rect.right=myChar.getScrX()+150;
  item.Box.rect.top=myChar.getScrY()+50;
  item.Box.rect.bottom=myChar.getScrY()+115;
  
  BitBlt(m_BackMemdc,myChar.getScrX()+100,myChar.getScrY()+50, item.getWidth(), item.getHeight(),item.hImgdc ,0, 0,SRCPAINT);
 }
 else if(item.Box.rife=FALSE)
 {
  item.Box.rect.left=NULL;
  item.Box.rect.right=NULL;
  item.Box.rect.top=NULL;
  item.Box.rect.bottom=NULL;
 }
 
 bool a=CollsionCheckBox(item.Box.rect,myChar.Attack.rect);

 if(a==TRUE)
 {//
  int b=rand()%3+1;
  myChar.setCharactorChange(b);

  item.Box.rife=FALSE;
 }
 if(myChar.Attack.fire==TRUE)
 {
  myChar.Attack.rect.left=myChar.Attack.x;
  myChar.Attack.rect.top=myChar.Attack.y;
  myChar.Attack.rect.right=myChar.Attack.x+120;
  myChar.Attack.rect.bottom=myChar.Attack.y+100;
 }else if(myChar.Attack.fire==FALSE)
 {
  a=FALSE;
  myChar.Attack.rect.left=NULL;
  myChar.Attack.rect.top=NULL;
  myChar.Attack.rect.right=NULL;
  myChar.Attack.rect.bottom=NULL;
 }

 

현재 구현하려는 소스는 캐릭터가 아이템 상자를 없앴을때 캐릭터가 변하는 형식으로 구현하는중인데요

일단 박스를 없애면 캐릭터가 변하는 것까지 되는데 문제는 공격키만 누르면 캐릭터가 계속 바뀌는건데요

분명 캐릭터 충돌박스는 키를 누르지 않았을 경우에는 생기지 않게 했고

아이템 박스도 마찬가지로 라이프라는 것을 이용해서 FALSE 일 경우 널이 되게 했는데도 계속

충돌 체크 함수가 TRUE로 리턴해버리는 겁니다

해결법좀 알려주시면 감사하겠습니다.(위치문제인것같은데)

 

참고로

BOOL CollsionCheckBox(const RECT& a,const RECT& b)
{
 if(a.left<=b.right&&a.right>=b.left&&a.bottom>=b.top&&a.top<=b.bottom)
  return TRUE;

 return FALSE;

}이런식으로 구현햇구요

이건 번외 질문이지만  bool a=CollsionCheckBox(item.Box.rect,myChar.Attack.rect); 이 부분을 맨 위로 올리면 a값이 트루가 되더군요
왜그런걸까요?