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

HTML

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Forum Contest: Build an HTML5 Game

Hi everybody,

It's time for a new Treehouse Forum contest! First, watch this video to learn more:

After you've watched the video, please read the details below carefully. I'm looking forward to your entries!

How to Enter: Create your game using any combination of HTML, CSS, and JavaScript. You can also use frameworks written in these languages. Your game should not require any browser plugins. For example, you cannot use Flash or the Unity web player.

Then, host your HTML5 game entry. You can do this on your own web hosting account, or as a "pen" on Codepen.io. When you're ready, you'll need to post two links:

  1. The first link should be directly to your working game. It should be immediately playable in modern web browsers.
  2. The second link should be to the code for your game. This can be in the form of Codepen's code view, a zip file, a GitHub repository, or any other format, as long as it's easy to immediately read all of your code.

You'll need to submit both links to be eligible. Entries with only the game link or only the code link will not be accepted.

Due Date: All entries must be submitted by May 11th at 11:45pm ET. Here's a timezone chart so you can see what time that is for your locale.

Prize: The entries will be judged by Treehouse teachers based on both design and code. One winner will receive a free month of Treehouse Pro on us! :) We'll announce the winner on May 12th and reveal the next contest.

23 Answers

All right !! That took forever but i'm finally done, pfew!

I tried to use (= learn) phaser.js which is a really great framework. I had to host it on my personal server because the game includes a lot of assets and i didn't know where to upload them since I dont have a PRO Codepen account :'(

Game

Source

Any asset I used which was not made by me has the source linked in the code comments.

Thanks treehouse for another great contest, good luck to all.

Cool.

Or you could use github pages: https://pages.github.com/. Nice choice of music, btw. :)

I tried to use that, but had some trouble loading some assets.

Thanks for the advice, i knew that something like that existed, just forgot how to find it.... I'll be sure to use it next time ;)

That music drives me crazy, heard it all day long during development !

Cute game! I had to delete my background (game over) music after listening to it for two days, I couldn't take it anymore.

Congrats Rémi.

Can Treehouse PLEASE make a course on how to do this??

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hi Josh Hicks,

Here's a two part Workshop about object oriented JavaScript that uses game programming as an example:

We also have some game dev lessons for iOS coming soon, and we plan to do more on game dev in the future. :)

This is my attempt. Had to finish it off in the long trip home from visiting parents this weekend - just managed to scrape the last of it together!

Game: http://williamdahl.com/connectfour/ Code: https://github.com/Will-D/ConnectFour

This looks awesome. Good job in the AI. And it works on mobile. Do we have a winner?

Wowsa. Thing kicked my butt. Seriously nice.

Really good job of the AI!

The color and shading is done perfectly.

I need to credit the source of a main part of the application. It is based on "Align 4" by "Will Boyd". http://codepen.io/lonekorean/pen/Gbwvc

I added some new functionality to allow the choice between single player and multiplayer.

I intended to make more changes, but was short on time.

Thanks folks. Appreciate the positive feedback!

Cool!

I beat the Ai on 5. It was tough at first but it is easy when you figure out the strategy.

Why must everything be pro :( I cant afford $50 but want awesomeness

Thats really cool man! Well done :)

I do feel like the game would benefit from some instructions through

Classic! Works great on my mobile portrait and landscape.

Thanks for the feedback! I went ahead and added some directions. Now that I think about it, it would have been cool to match the hero to the appropriate villain, but oh well haha

My first forum contest :)

Game: http://www.chrisdawson.me/iesweeper/ Code: https://github.com/chrisdawsondev/iesweeper

I found it very challenging to get it working like the original Minesweeper game but feeling very proud of myself right now for doing it!

You should be proud. This is really a solid implementation.

PS Nice touch with the IE icons as mines.

Thank you :)

Wow, this is very impressive well done!

The only criticism I can say about this, upon hitting a mine it is not visually apparent how the user is to restart the game. Can I recommend solving this problem by perhaps adding in a refresh button.

Thanks for the feedback :) You can press the face icon to reset the game but maybe I need to make this more obvious somehow.

Just added a win/lose message with reset button :)

ios7is

Game: http://davbik.github.io/ios7is/

Properly(no, not really) commented code: https://github.com/davbik/davbik.github.io

Love it! Modern twist on a classic.

I love the fact that the game is on an iPhone. Clever compartmentalization.

Now that I have had a chance to play, I love it even better. I also love the iPhone icons.

A suggestion: The text "Click to Start" is really hard to read. I'm not sure what the right answer is, but you need more contrast. It may be as simple as black text, but you'll need to try and see.

Really nice ! Forgot how bad I am at tetris... died 3 times without being able to delete one single line...

Thank you for the feedback, John. I updated the game.

Here is my epic game, dragoontail, i did it for a assessment, it is not finished though i still have to make the dragon animate, add sound, and make the game end on impact with the birds, and do better graphics

http://codepen.io/LadyEpic/pen/vaKrp

was i too late ? :S i hope not

I hope not. This is really cool.

For those who aren't pro, can you suggest an eligible framework? The ones I've looked at aren't written in JS.

Nick Pettit
Nick Pettit
Treehouse Teacher

I've heard good things about Phaser: http://phaser.io/

You can also check out this list, which should include lots of JS frameworks: http://html5gameengine.com/

In all fairness Nick Pettit I think most students myself included will need more than a week to pick up phaser.io and put together a game from it!

The deadlines seem a bit skewed to me one week to create a toggle, one week to create a form - ok great those are isolated features that's realistic. One week to create a game seems like a stretch to me, especially as Monday was a holiday so in effect it's a 6 day week here in the UK.

Just my 2 cents :)

Nick Pettit
Nick Pettit
Treehouse Teacher

Richard Duncan,

I totally agree that it's a pretty intense deadline, but we also received over 100 entries for the contact form contest. Upcoming contests are a bit easier, but we wanted to present a pretty intense challenge to see what kind of response we get. Another way to look at it is less competition. So far there are zero entries, so if you create a super simple clone of Pacman, Pong, Snake, Space Invaders, or whatever, odds of winning are pretty good.

Any chance of an extension on this deadline if there are say less than 10 entries? I'm away tomorrow for two days and would really have liked to submit an entry I've just not had the time!

I finnished a simple game, but it doesn't work in codepen, doesn't look nearly as good either in codepen as it does in firefox or chrome.

I imagine it would be alright to create a Workspace of your submission and post the link to the rendered page. Then post your code via one of the methods that Nick Pettit mentioned in the op.

Ok here it goes, with all the newbie skills I could muster. 100% origional work. 1. gameLink

  1. codeLink
Nick Pettit
Nick Pettit
Treehouse Teacher

I just checked this out, looks cool!

Workspaces only last for about 15 minutes right now, so eventually this link will go down. You should try to host this someplace else on the web.

Did not know that about Workspaces.

Got it to work in CodePen!! happy dance! http://codepen.io/Leebus/full/jopbw/

And they said that it could not be done. This is awesome!

Work on mobile too.

Yeah, works on tablets, didn't try it on mobile. My plan was to add levels like defuse the bomb at lvl 2 and make it a spy adventure.

Good idea to keep it simple for a one week deadline. You can add stuff later.

Happy Kitty Game: http://www.ashlynnpai.com/games/happykitty/

Please use Chrome or Firefox. Audio is enabled. Requires a keyboard.

I found an amazing tutorial online. I just decided to follow it and try to tweak the code. This was only possible for me because Steven explained every line of his code. Thank you Steven! Before this the longest thing I ever coded or debugged was around 30 lines of Python for a Coursera class a month ago.

http://blog.sklambert.com/html5-canvas-game-panning-a-background/.

The changes I made are listed in https://github.com/ashlynnpai/kittygame/blob/master/readme.rtf. If not listed here assume the code is Steven's unmodified.

Code at https://github.com/ashlynnpai/kittygame.

Please let me know of additional bugs not already listed in the README.

I'll have to try this later when I have a keyboard. Look cool.

Awesome!!

I've been working on a game for a couple of months now. The game was first designed in the middle of 2013, and after a couple months, due to school work, I have not worked on it for awhile. A few months later, during the year of 2014, ideas such as online multiplayer have risen, and soon enough I went back to work on my game. Last week I incorporated Node JS and Socket IO as an add-on to my game. My question is, due to the fact that I worked real hard, may I be able to not present my source code? I know judges will look at neatness of the code, and the gameplay mechanics, but I the project was made with hard work and patience, and I feel that showing my source code, as educational as it is to show people how it was made, really, to me at least, obstructs the fact that I worked hard on it. Can there be any exceptions? I recently logged in, and I had just noticed this contest was posted 3 days ago, while my game was released just a day ago.

If exceptions can be made, I will post my game. If not I will just make a new one. I am happy with either decision. This is a fun contest after all.

Regards, Guled

Nick Pettit
Nick Pettit
Treehouse Teacher

Hi Guled,

I understand your predicament, but to be fair to other entries, you'll need to share your code here. Sorry!

Nick

No worries. Thank you for making this contest. Also here is the game I was working on. I still have to make it quite responsive for mobile use, but for desktop/laptop usage it proves to be fine (I hope, for all screen resolution cases).

This looks really slick. It is obvious that a lot of time and thinking has gone into this.

Thank you. I appreciate your comment.

Here's my entry:

code / full

This was supposed to be my revenge for last week, but as I post, the project is still "missing a little polish." No matter. Next week will be better.

I think I need instructions. I think it matters less that its polished. Just starting a game and coding it is miles ahead of people who didn't even bother.

I agree. Thanks for the feedback.

Oops. Maybe I could give instructions here (seeing as the game doesn't include any).

The goal is to beat the clock in a boxing match. Hover the mouse on the left or right side to block his punches. Click to punch. Each punch reduces the health to zero.

Sorry, but there isn't any "you won" screen. In fact, the game never ends, and the clock keeps on punching. A little polish is all, right?

John, will you connect with me on LinkedIn?

I would be honoured. Alas, your LinkedIn profile requires an email address, so I cannot sent a request. My LinkedIn profile is included in my Treehouse profile.

Lol that is kinda fun! It's so fast though it does feel a bit like a seizure in the works.

Thanks. As I said ... it works, but it is still a bit rough on the edges.

Took me a while to figure it out, but its great and original ! Good job

This is not finished and it certainly is not to replace my entry; this is where I was going with the feedback:

code / full

I redid it from scratch and actually learned a bit. A lot of my problems are in the basics, so I spent a lot of time watching old videos. I was doing GREAT until I reached the point where I wanted to add the boxing gloves. Same problem with responsive design that I always have.

I was then going do do several images of boxing gloves in different positions (I think that there is 8 for each). At any time, only one of 8 images would be visible. Neat, huh? The idea was to load each of them with their own z-index, center them, and let the browser worry about sizing them. I figure that if they are all the same height and all scaled to height, it should work out.

But I ran out of time ....

That's the first time I enter a contest here at treehouse. It's a pretty simple game, but it's all I am capable of so far Code: http://codepen.io/offline_blogger/pen/Kedtr | Full: http://cdpn.io/Kedtr

It is well executed all around. Good choice of font.

Oh thank you! :)

This was not an easy one, but I feel like a winner for just attempting it. I let it irritate me to the point where I wouldn't quit until I got it done. Game | Code

Looks good man well done! reminds me of continuum!

Nice work! I agree about not an easy competition, but you have done well!

If I could have a team of you -- people who would not quit -- there is nothing that team could not do. If I were an employer, I'd hire you.

Great looking game. Alas I do not have a keyboard just now, so I'll have to try this later.

Thanks guys. I really wish I had more time to develop it. I had hopes of introducing enemy ships (Reavers), but I ran out of time. The ship picking up the Space Mikes is Serenity from Firefly. I had to make it even more nerdy!

The physics/handling of the Firefly is great. I also like the background ALOT.

Nick Pettit
STAFF
Nick Pettit
Treehouse Teacher

Hi everyone,

These games are absolutely amazing! This was a much more difficult contest than usual, so I'm very impressed at the number of high quality entries. You should all feel really good about the work you've done.

After much deliberation, we chose Rémi BRUGUIER's game Panda Panic as the winning entry. Congratulations, Rémi! The game uses Phaser.js and, while the artwork is not original, it has all been cleverly combined from many different sources to create something new. The code itself is pretty fascinating and provides lots of good examples for aspiring game developers.

Again, I want to emphasize how tough this decision was to make. All of the entries are pretty amazing and should be considered a nice addition to your personal portfolios. If you didn't win this time around, don't give up! We do these every week and they're meant to provide you with practice. :)

Naomi Freeman
Naomi Freeman
Treehouse Guest Teacher

Nice! Congrats :) Psst: there is a tiny bug. Sometimes the panda falls through the floor as he drops down lol

You did a great job though. I built one in limejs but couldn't push it because lime wouldn't work on my home comps and was getting confused on my work comp :/

I appreciate how much had to go into this :)

Will there be a new contest this week?

Well thanks treehouse and everybody for the kind comments !

See you at the next contest :)

Nick Pettit
Nick Pettit
Treehouse Teacher

Yep! There will be a contest this week. We had some trouble encoding the video today, but it's ready now and should go up tomorrow. :)

Well done Rémi!

Perfect! Thanks

PHP?

Nick Pettit
Nick Pettit
Treehouse Teacher

No, sorry. We'd really like these to be in HTML, CSS, and JavaScript.

Anybody having trouble with the simple game walkthrough in the video before lime.js? I can't get my code to work. I think it has to do something with the imgFrog.addEventListener("load",init,false); I tried to add an alert to the init() function and still nothing.

If we are just grabbing html from a PHP script, is that alright?

Nothing.

Nothing 2