2012年3月11日 星期日

Homework 5 Anton Carlson


In this project I understand how to use the keyboard to control an image. I used the arrow keys instead of the A-Z keys. The code for using the arrow keys is:

if(keyCode == KeyEvent.VK_RIGHT)
      X_Position+=20;
    if(keyCode ==  KeyEvent.VK_LEFT)
      X_Position-=20;
    if(keyCode == KeyEvent.VK_UP)
      Y_Position-=20;
    if(keyCode == KeyEvent.VK_DOWN)
      Y_Position+=20;


沒有留言:

張貼留言