Page 1 of 1

Coding

Posted: Mon Aug 07, 2017 7:32 pm
by Frozensoul
Does anyone know how to code html and javascript to make games?
I just started learning code and I am having such trouble with sprite sheets, I cannot figure out how to make my sprite sheet animate, instead it just shows all of the frames at once.

Can anyone help?

Re: Coding

Posted: Mon Aug 07, 2017 7:55 pm
by Loco cola
Does anyone know how to code html and javascript to make games?
I just started learning code and I am having such trouble with sprite sheets, I cannot figure out how to make my sprite sheet animate, instead it just shows all of the frames at once.

Can anyone help?
Not experienced with using HTML and JavaScript to write game coding. If your looking for something easier and more understandable I suggest you start with C++ or Objective-C. JavaScript isn't really used often nowadays and the central use for HTML is websites

Re: Coding

Posted: Mon Aug 07, 2017 8:12 pm
by xAndrey
Does anyone know how to code html and javascript to make games?
I just started learning code and I am having such trouble with sprite sheets, I cannot figure out how to make my sprite sheet animate, instead it just shows all of the frames at once.

Can anyone help?
Not experienced with using HTML and JavaScript to write game coding. If your looking for something easier and more understandable I suggest you start with C++ or Objective-C. JavaScript isn't really used often nowadays and the central use for HTML is websites
I would suggest taking some courses in computer science and such.

Re: Coding

Posted: Mon Aug 07, 2017 8:29 pm
by Loco cola
Does anyone know how to code html and javascript to make games?
I just started learning code and I am having such trouble with sprite sheets, I cannot figure out how to make my sprite sheet animate, instead it just shows all of the frames at once.

Can anyone help?
Not experienced with using HTML and JavaScript to write game coding. If your looking for something easier and more understandable I suggest you start with C++ or Objective-C. JavaScript isn't really used often nowadays and the central use for HTML is websites
I would suggest taking some courses in computer science and such.
Heh? I code for a hobby and side job and I've been doing it for 5years or so

Re: Coding

Posted: Mon Aug 07, 2017 9:10 pm
by Frozensoul
Not experienced with using HTML and JavaScript to write game coding. If your looking for something easier and more understandable I suggest you start with C++ or Objective-C. JavaScript isn't really used often nowadays and the central use for HTML is websites
I would suggest taking some courses in computer science and such.
Heh? I code for a hobby and side job and I've been doing it for 5years or so
you can do a lot more with javascript... rather than just html, html is the structure of webpages. JavaScript gives it functionality, I just can't figure out how to animate the freaking spritesheet. ughhhh

Re: Coding

Posted: Mon Aug 21, 2017 3:07 am
by zchicken1
I know unity JavaScript/unityscript (Unity GameEngine)

HTML is for coding sites
Most others are for software
There's also HTML5 (that's the name?) newer version which I think can make little games
JavaScript is more site functionalities idk about games tbh
C, C++, C# is what you learn if you want a career in game dev (I still haven't done that)
There's also Python which is very simple and can make small games
There's Ruby (Idk what it is tho lol)
The one for IOS games is umm forgot the name *searches it up* Objective-C and C oh ok I was thinking Xcode but that's a platform for developing the games huh.
What else hmmm, oh for servers I think it's SQL I don't know jack about that.
Yeah that's all I know.
But for games don't go HTML or JS.

ALERT: If I were you I'd start with any of the C languages cause I find them hard to pick up after learning Unity JS, the class system confuses me.

Re: Coding

Posted: Mon Aug 21, 2017 9:07 pm
by Regenleif
Java is great -- you can embed the webplayer into a website; many online games are made this way.

Re: Coding

Posted: Wed Aug 30, 2017 7:24 am
by flough
I am an expert in Javascript
To animate a sprite you need an element, CSS to set it to the size of one entity of the sprite, and you need to the change the css background position x
This is very basic stuff. I have built game engines with 3d model loading, physics, collision detection, ray casting, etc. all in pure vanilla javascript. I have even ported C++ physic libraries to JS and loaded them with ASM JS. That being said, If your goal is to develop games and you are already not a master in JavaScript, I recommend you focus your efforts on learning unity.

The learning curve on web development is not as steep as unity or some of the other options people are suggesting, however it is even more steep to build complex games in JS code than to build them in something like unity. Unity has html5 modules so you can run the game in a browser. You can also do the scripting in JS code. However if you really want to animate a sprite in JS code here you go:

HTML:

Code: Select all

<doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> <div class="animate"></div> </body> </html>
CSS:

Code: Select all

.animate { background-image: url('https://s3.envato.com/files/206414112/2D%20Game%20Character%20Sprites%20%20(2).jpg'); width: 70px; height: 130px; background-position-x: 905px; background-position-y: 295px; }
JS:

Code: Select all

var speed = 100; var positions = [1428, 1319, 1210, 1102, 996, 905]; var index = 0; setInterval(function(){ if (index > (positions.length - 1)) { index = 0; } $('.animate').css('background-position-x', positions[index] + 'px'); index++; }, speed);
Here is a codepen: https://codepen.io/mattgardner/pen/prQxbe