How to add controls to image/sprite?

Recommended Posts

So to get right to the point. I am having issues with my ship image/sprite and my drawn objects on screen disappearing as soon as I try and addEventListener to code. why does my code essentially break when i add the EventListener? is it not possible to add controls to image or sprite within Html canvas?


Ship game code =

Share this post

Link to post
Share on other sites

Looks like you're doing something based on this tutorial: I guess you forgot to change "paddleWidth" to "ship.width" ;)

And your code probably breaks because of typos in your handlers names. They are currently named keyDownHander and keyUpHander. Note the missing l.
Also there are probably some issues related to "collision checks". I could be more helpful if you described what kind of behaviour you're trying to achieve.

And yeah, would be nice to look at full project.

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

  • Recently Browsing   0 members

    No registered users viewing this page.