Josh
Josh

Reputation: 1052

Javascript Game Development equivalent of Pygame.org?

I am starting to learn and develop games in Javascript. I was just wondering if there are websites for Javascript game development analogous to http://pygame.org/news.html. Pygame/Python was the first language I learned how to develop games on, and I think part of the reason why I ever finished a game was because most of the developers on that site allowed you to view the source code to their games. That helped me learn more than anything (if they were commented well).

I am probably going to use the Crafty game engine, so anything related to that will help as well. With that being said, I did look over most of the websites listed in this question. Any other general help regarding Javascript is also welcome. Thanks in advance.

Upvotes: 3

Views: 5530

Answers (3)

Willmil11
Willmil11

Reputation: 1

This is a quick start guide but for the docs go to (The readme is the docs): https://www.npmjs.com/package/nodegamesjs

Run in the terminal: npm install nodegamesjs Then write in your code:

var nodegames = require("nodegamesjs");
nodegames.init();
    
var width = 800;
var height = 600;
nodegames.newGame(async function (game) {
    console.log("[Game] Game opened.");
    game.setWindowName("Mygame");
    game.on("close", function () {
        var process = require("process");
        process.exit(0); //Exit because game window has been closed.
    });
    while (true) {
        //Draw stuff do your stuff. (game loop)
        //
        //
        game.renderFrame(); //Render the frame that has just been drawn.
        await new Promise(function (resolve, reject) {setTimeout(resolve, 10)}); //Wait 10ms for stability and to let events run.
    }
});

I made the package, hope ya like it.

Upvotes: 0

Rybar
Rybar

Reputation: 11

You can go a long ways with no game library, just 2d canvas and vanilla JS in the browser. Here's some great links to get started:

Mary Live Codes a JavaScript Game From Scratch in 30 minutes, and does a great job of explaining what she's doing as she does it. https://www.youtube.com/watch?v=hbKN-9o5_Z0

Franks Laboratory is all about creative coding and game development with just JS and the browser. https://www.youtube.com/c/Frankslaboratory

If text tutorials are more your speed, CodeIncomplete has a great series on JavaScript game development, it's older but all the info still applicable/works today in all browsers. This site is largely how I got started in HTML5 game development.
https://codeincomplete.com/games/

JS13K, a yearly game jam where you have a month to create a JS game in 13 kilobytes of zipped JS, has a great resources page, although some of this stuff is specific to making your game tiny, there's lots of micro-frameworks for JavaScript games. I've participated in JS13K in some form since 2016. https://js13kgames.github.io/resources/ https://js13kgames.com

Happy to help if you have specific questions!

Upvotes: 1

GameJS is a JavaScript library inspired by PyGame. PyGame vs GameJS
(source: gamejs.org)

Note that the GameJS code on the comparision is a bit outdated and it doesn't work on current release

You can also see a lot of games made using GameJS. You can see that games here: http://gamejs.org/showcase.html

Upvotes: 3

Related Questions