I currently have a little excel snake game made which uses a variable called 'direction' which can have the value left, right, up or down to determine direction the code below shows basically how the code presently works:
The macro "left" is assigned to a command button which when pressed obviously changes direction variable, this works fine. Is there any way to do this on a keypress of the left arrow. unfortunately as I have seen from searching there appears to be no way to get an onkey command to run during a DoEvents break.
Code:
Sub snake()
start:
if direction = "left"
'move left
end if
if direction = "right"
'move right
end if
if direction = "up"
'move up
end if
if direction = "down"
'move down
end if
'wait for x seconds
doevents
goto start
End sub
'the below is repeated for left, right. up, down
Sub left()
direction = "left"
End sub
The macro "left" is assigned to a command button which when pressed obviously changes direction variable, this works fine. Is there any way to do this on a keypress of the left arrow. unfortunately as I have seen from searching there appears to be no way to get an onkey command to run during a DoEvents break.