Quote (Eleven11 @ Jul 10 2012 06:23pm)
it is possible.. you are using forms right?
// Create a new event for the keydown action.
this.KeyDown += newSystem.Windows.Forms.KeyEventHandler(this.FormName_KeyDown);
// Add code to it
private void FormName_KeyDown(objectsender, KeyEventArgse)
{
if(e.KeyCode == Keys.Left)
{
// Your code here
}
}
Also note that this code will execute every update while the key is down. It would actually be more efficient to change the state of the images from not displaying to displaying when the key state changes from KeyUp to KeyDown and then change the state back again on KeyUp. It really doesn't matter that much since you aren't going to bottleneck here but it's good practice to try and write code that is the most obviously optimized whenever you can. Just my 2 cents.
This post was edited by Thrasher66099 on Aug 19 2012 10:56pm