C# - Tetris clone - Can't get block to respond properly to arrow key combinations

前端 未结 3 626
野趣味
野趣味 2021-01-06 09:16

I\'m working on programming a Tetris game in Visual C# 2005. This is the most extensive program I have designed yet.

I create a shape class and a block class to cont

3条回答
  •  孤城傲影
    2021-01-06 09:51

    Sorry, no specific help... it's saturday night after all... however:

    Each key needs a state. When you get a keydown event, you can tell which key went down, and modifiy the keystate you are maintaining. When the key comes back up, once again, from looking at the event, you can tell which it was. Only modify the state of the key that the event was fired against: i.e. don't reset all states with the keyup event, otherwise the state of keys you are holding in memory will be corrupted, as you are seeing.

提交回复
热议问题