• Content Count

  • Joined

  • Last visited

  1. I am getting lost in this whole endeavor of HTML/JS game development because every tutorial I go through seems to do things completely differently or uses a completely different engine. So I decided to take a break and try to figure some things out on my own. I wrote this code for my character movement. I have not had the chance to try it yet because the rest of my world is not set up. I just wanted to drop it here and see if you guys think it would work or not. Basically, it's just an event listner (for a key press) with a switch in the function to determine direction. window.addEventListener("keyDown", function(k) { switch(k.keyCode) { case 87: // Up with W key. hero.src = "assets/faceUp.png"; if (hero.y >= 320) { break; } else { hero.y = hero.y + 32; break; }; console.log("Up"); case 83: // Down with S key. hero.src = "assets/faceDown.png"; if (hero.y <= 0) { break; } else { hero.y = hero.y - 32; break; }; console.log("Down"); case 65: //Left with A key. hero.src = "assets/faceLeft.png"; if (hero.x <= 0) { break; } else { hero.x = hero.x - 32; break; }; console.log("Left"); case 68: //Right with D key. hero.src = "assets/faceRight.png"; if (hero.x >= 320) { break; } else { hero.x = hero.x + 32; break; }; console.log("Right"); });
  2. Forgive me for reviving this, although it is sticky. I'm much past learning JavaScript for web design and development. I just don't aspire to do that anymore. I feel, though, that all these tutorials and books are going to teach me JS in relation to web design. Is there a path to take in order to learn JS as it applies to creating games?
  3. My main inspiration for aspiring to learn to create games is that I want to recreate a childhood favorite of mine: Monster Rancher. Of course, my version would be 2D. Ultimately, the game should be exceedingly easy to make and I'd love to play something like it again. (My opinion may change after slaving over Sublime Text for months.)