貪喫蛇5

void CPointmoveView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
 // TODO: Add your message handler code here and/or call default
 switch(nChar)//WM_KEYDOWN響應
 {
 case VK_UP:
  if(movepoint[0].r!=2)
   movepoint[0].r=1;
  break;
 case VK_DOWN:
  if(movepoint[0].r!=1)
   movepoint[0].r=2;
  break;
 case VK_LEFT:
  if(movepoint[0].r!=4)
   movepoint[0].r=3;
  break;
 case VK_RIGHT:
  if(movepoint[0].r!=3)
   movepoint[0].r=4;
  break;
 }
 CView::OnKeyDown(nChar, nRepCnt, nFlags);
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章