Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


jQuery Keydown Movement

I am trying to make the plane img go across the screen. I have attached my code below. What am I doing wrong? Do I need to incorporate a specific script plug-in?


2 Answers

Tom Mertz
Tom Mertz
15,254 Points

I just loaded up your codepen and I was able to get the image icon to move across the screen and go up, down, and back with wasd. Was that what you were trying to do?

James Barnett
James Barnett
39,199 Points

Your JQuery works fine, I'm not sure what you are seeing. I forked your pen, added in plane & background image instead of the local images that codepen was 404'ing on. I also changed the delay on .animate from 'fast' is is 200ms down to 1 to reduce the lag.