게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
api 충돌체크에 질문드립니다.
게시물ID : programmer_15787짧은주소 복사하기
작성자 : 우아앙무지개
추천 : 0
조회수 : 2101회
댓글수 : 12개
등록시간 : 2016/02/11 13:13:42
옵션
  • 본인삭제금지
std::list<C_OBJ*>::iterator itorM = m_cObjMgr.getMonsterBulletBegin();
 std::list<C_OBJ*>::iterator itor = m_cObjMgr.getPlayerBegin();
 std::list<C_OBJ*>::iterator itorP = m_cObjMgr.getPlayerBulletBegin();
 std::list<C_OBJ*>::iterator itorMs = m_cObjMgr.getMonsterBegin();


 while (itor != m_cObjMgr.getPlayerEnd())
 {
  C_OBJ *pObj = *itor;
  int getRenderId = pObj->getRenderId();
  int nWidht = m_cDcMgr.getWidht(getRenderId);
  int nHeight = m_cDcMgr.getHeight(getRenderId);

  BitBlt(m_cDcMgr.getDc(2), (int)pObj->getPositionX(), (int)pObj->getPositionY(), nWidht, nHeight, m_cDcMgr.getDc(getRenderId), 0, 0, SRCCOPY);

  m_nPlayerPosX = (int)pObj->getPositionX();
  m_nPlayerPosY = (int)pObj->getPositionY();

  pObj->setMonsterBulletRECT(m_nMonsterBulltePosY, m_nMonsterBulltePosY + nHeight, m_nMonsterBulltePosX, m_nMonsterBulltePosX + nWidht);
  pObj->setPlayerRECT(m_nPlayerPosY, m_nPlayerPosY + nHeight, m_nPlayerPosX, m_nPlayerPosX + nWidht);

  if (pObj->getRECT())
  {
   m_cObjMgr.m_listPlayer.erase(itor++);
  }
  else
   itor++;

 }

 while (itorM != m_cObjMgr.getMonsterBulletEnd())
 {
  C_OBJ *pObjm = *itorM;
  int getRenderId = pObjm->getRenderId();
  int nWidht = m_cDcMgr.getWidht(getRenderId);
  int nHeight = m_cDcMgr.getHeight(getRenderId);

  BitBlt(m_cDcMgr.getDc(2), (int)pObjm->getPositionX(), (int)pObjm->getPositionY(), nWidht, nHeight, m_cDcMgr.getDc(getRenderId), 0, 0, SRCCOPY);

  m_nMonsterBulltePosX = (int)pObjm->getPositionX(); m_nMonsterBulltePosY = (int)pObjm->getPositionY();

  pObjm->setMonsterBulletRECT(m_nMonsterBulltePosY, m_nMonsterBulltePosY + nHeight, m_nMonsterBulltePosX, m_nMonsterBulltePosX + nWidht);
  pObjm->setPlayerRECT(m_nPlayerPosY, m_nPlayerPosY + nHeight, m_nPlayerPosX, m_nPlayerPosX + nWidht);


  if (pObjm->getRECT())
  {
   m_cObjMgr.m_listMonsterBullet.erase(itorM++);
  }
  else
   itorM++;

 }

 while (itorMs != m_cObjMgr.getMonsterEnd())
 {
  C_OBJ *pObjMs = *itorMs;
  int getRenderId = pObjMs->getRenderId();
  int nWidht = m_cDcMgr.getWidht(getRenderId);
  int nHeight = m_cDcMgr.getHeight(getRenderId);

  BitBlt(m_cDcMgr.getDc(2), (int)pObjMs->getPositionX(), (int)pObjMs->getPositionY(), nWidht, nHeight, m_cDcMgr.getDc(getRenderId), 0, 0, SRCCOPY);

  m_nMonsterPosX = (int)pObjMs->getPositionX(); m_nMonsterPosY = (int)pObjMs->getPositionY();
  pObjMs->setPlayerBullteRECT(m_nPlayerBulltePosY, m_nPlayerBulltePosY + nHeight, m_nPlayerBulltePosX, m_nPlayerBulltePosX + nWidht);
  pObjMs->setMonsterRECT(m_nMonsterPosY, m_nMonsterPosY + nHeight, m_nMonsterPosX, m_nMonsterPosX + nWidht);
  if (pObjMs->getPlayerBulletRECT())
  {
   m_cObjMgr.m_listMonster.erase(itorMs++);
  }
  else
   itorMs++;
 }

 while (itorP != m_cObjMgr.getPlayerBulletEnd())
 {
  C_OBJ *pObjp = *itorP;
  int getRenderId = pObjp->getRenderId();
  int nWidht = m_cDcMgr.getWidht(getRenderId);
  int nHeight = m_cDcMgr.getHeight(getRenderId);

  BitBlt(m_cDcMgr.getDc(2), (int)pObjp->getPositionX(), (int)pObjp->getPositionY(), nWidht, nHeight, m_cDcMgr.getDc(getRenderId), 0, 0, SRCCOPY);

  m_nPlayerBulltePosX = (int)pObjp->getPositionX(); m_nPlayerBulltePosY = (int)pObjp->getPositionY();

  pObjp->setPlayerBullteRECT(m_nPlayerBulltePosY, m_nPlayerBulltePosY + nHeight, m_nPlayerBulltePosX, m_nPlayerBulltePosX + nWidht);
  pObjp->setMonsterRECT(m_nMonsterPosY, m_nMonsterPosY + nHeight, m_nMonsterPosX, m_nMonsterPosX + nWidht);

  if (pObjp->getPlayerBulletRECT())
  {
   m_cObjMgr.m_listPlayerBullet.erase(itorP++);
  }
  else
   itorP++;
 }


리스트로 하나하나 입력 받아서 충돌시에 총돌한 리스트를 지우는 로직인데요.
제가 뭘 잘못한건지 총알을 발사를 하면 가장 마지막으로 발사한 총알만 충돌 처리가 되네요.
총알을 두번 쏘면 두번째 총알만 충돌 처리가 되요..
고칠 수 있는 방법좀 알 수 있을까요?
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호