Excel下实现贪吃蛇小游戏(5) End If End If Select Case oldhead_movement Case 1 'right nextrow = headrow nextcol = headcol + 1 Case 2 'up nextcol = headcol nextrow = headrow - 1 Case 3 'left nextrow = headrow nextcol = headcol - 1 Case 4 'down nextcol = headcol nextrow = headrow + 1 End Select '看是否超出游戏区域了。 If nextcol = left Then nextcol = right - 1 ElseIf nextcol = right Then nextcol = left + 1 End If If nextrow = top Then nextrow = bottom - 1 ElseIf nextrow = bottom Then nextrow = top + 1 End If
If Cells(nextrow, nextcol).Interior.ColorIndex = color Then '蛇头碰到蛇身了,游戏结束 Call game_over: Exit Sub End If If Cells(nextrow, nextcol) = "*" Then Call score_