Sign in to follow this  
Souleste

Help with controlling spritesheet with arrow keys

Recommended Posts

Hi, new to the forums, as well as new to coding. Started learning about a month ago.

I need help with my javascript code, I want to be able to use the arrow keys to move my character up, right, down, left, but I cannot figure out how to, I watched a video from Treehouse learning how to do this, and then I decided I would also make a separate one for myself so I copied some of the code, but It will not animate or move the sprite sheet.

The character just sits in the middle of the page even though I thought that I coded him correctly to move. He also doesn't even animate, it's completely still. 

I did however notice that when I made my background larger, that the screen would move, but I want the character to move over the screen, not move with the screen. Please help.

 

  

reddude.png

game.js

index.html

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.