is it possible to run pygame or pyglet in a browser?

后端 未结 3 1851
陌清茗
陌清茗 2020-11-30 12:27

I have 3 game libraries installed on my PC: pyglet, pygame and Panda3D.

I would like to create a 2D game and make it a web browser game so i can put it on facebook.<

相关标签:
3条回答
  • 2020-11-30 13:05

    Repl.it -- an online IDE -- just announced Pygame and any other Python GUI or game library. You can start here.

    Here are some examples:

    • Pyglet example
    • Tetris in pygame
    0 讨论(0)
  • 2020-11-30 13:07

    It requires a bit of reprogramming, but i made a pygame library "port" to the browser/nodewebkit using Brython and GameJS. You can program using a version of pygame and python 3 in the browser. You can check it out at https://github.com/asherwunk/pygjs

    0 讨论(0)
  • 2020-11-30 13:14

    Neither pyglet nor pygame will run in a browser. I wouldn't really recommend using Python at all if you target is a web browser. JavaScript (with HTML5 Canvas), Flash, or Java applets are better suited for that environment.

    If you're dedicated to the idea of using Python, there are a number of projects that can compile Python into JavaScript. There are some mentioned on the Python wiki. Here are a few:

    • Skulpt
    • Pyjamas
    • Pyjaco

    You'll need to write your own graphics and audio systems, though, since none of those projects can convert the native code needed by pyglet and pygame into JavaScript.

    0 讨论(0)
提交回复
热议问题