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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.