Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Making JS game, but can't get sprite to work....help please?

I am struggling to make my own HTML5 game. I have some code from a space invaders game that I want to "mashup" with Zelda NES sprites to test my vanilla JS skills. So far...um....I'm overwhelmed :) I can't get the Link sprite to appear correctly and loop consistently. All I want to do is make it so I have a sprite that has two frames loop I enter the keys for left or right. When nobody is clicking anything I want Link facing "north" towards those place holder black boxes. Does this make sense what I am trying to do?

Here is an example of what I have so far: https://w.trhou.se/psmjugaq74

1 Answer

Steven Parker
Steven Parker
243,199 Points

The URL given for the sprite seems to be for a page with information that includes the sprite instead. I substituted "https://image.ibb.co/j2kqCG/link.png" for the URL and the sprite appeared, dancing back and forth.

It looks like you still need to add keyboard event handlers but perhaps having the sprite visible will help get you going again.