Jump to content
  • Advertisement
Sign in to follow this  

Javascript Won't Run with Tutorial GitHub Code

This topic is 1584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So as you all know, I am an absolute beginner to all things Javascript and HTML.

I do have some prior knowledge from CodeAcademy courses and general youtube videos, but it's not anything to go by in terms of game development.


I've been following this tutorial http://www.lostdecadegames.com/how-to-make-a-simple-html5-canvas-game/ (thanks to Avalander for the link)

on the topic of making a simple canvas game. 


My problem is this. It doesn't run. After failing to run on my own hand-written code, I opted to copy/pasting the GitHub code instead. Didn't work either.


Maybe it's an issue with the way I connect the .png's to the code? Possibly. However, I've tried: 


Downloading the images and putting it in the same folder, naming everything correctly


Including a direct internet link in the HeroImage.src = "http://xxxxxx.png


Putting the entire .js code into the html file as <script> </script>. Although the images didn't show up, I was able to see the document.write ("This code ran!") I included and the height of the canvas by highlighting it with the cursor. 


Any thoughts on what the problem could be? My Javascript education would seriously take a hit if I keep doubting my own browser/computer.



Might be worth mentioning that I've had tutorials fail me in the past. 


This would work: 

While this would not: 


Thanks for reading, gaiz. 

Edited by Frolicks

Share this post

Link to post
Share on other sites

I downloaded the github project and it runs in Firefox without problem. 


Thanks to you, I realized that I could download Github projects.


My problem was, I didn't understand how to properly write the "src" to connect to my images. Downloading the file and seeing all the folders helped me realize that, thanks.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!