Use the arrow keys to move, press space to attack the red squares. This is a work in progress and is not nearly done, but if you want to learn from how I made movement and attacking work, take a look here.