I tried your code and it worked fine except the keys are a bit confused.
You're using the W key to move left,
the S key to move right,
the A key to move up and,
the D key to move down.
Are these the keys you meant to assign to those directions?
You're using the W key to move left,
the S key to move right,
the A key to move up and,
the D key to move down.
Are these the keys you meant to assign to those directions?