C语言实现推箱子游戏完整代码 (6)

向右移动

void moved(){ if(y<9){ if(screen[x][y+1]==1){ return; }else if(screen[x][y+1]==4){ screen[x][y+1]+=3; screen[x][y]-=3; y++; } else if(screen[x][y+1]==0){ screen[x][y+1]+=3; screen[x][y]-=3; y++; }else if(screen[x][y+1]==2||screen[x][y+1]==6){ if(screen[x][y+2]==0){ screen[x][y+2]+=2; screen[x][y+1]+=1; screen[x][y]-=3; y++; }else if(screen[x][y+2]==4){ screen[x][y+2]+=2; screen[x][y+1]+=1; screen[x][y]-=3; y++; }else if(screen[x][y+2]==2){ return; }else if(screen[x][y+2]==1){ return; } } } }

主函数

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwxgfs.html