https://github.com/python-ninja-hebi/python-vegan-blaster
Simple arcade game with python and pygame
https://github.com/python-ninja-hebi/python-vegan-blaster
gamedev pygame pygame-games python
Last synced: 4 months ago
JSON representation
Simple arcade game with python and pygame
- Host: GitHub
- URL: https://github.com/python-ninja-hebi/python-vegan-blaster
- Owner: Python-Ninja-Hebi
- Created: 2023-06-25T11:46:39.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-25T11:48:05.000Z (about 2 years ago)
- Last Synced: 2025-01-14T10:33:36.778Z (6 months ago)
- Topics: gamedev, pygame, pygame-games, python
- Language: Python
- Homepage:
- Size: 21.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.ipynb
Awesome Lists containing this project
README
{
"cells": [
{
"cell_type": "markdown",
"id": "f4169895-9110-4d6a-8552-3ee0d49d8270",
"metadata": {},
"source": [
"# pygame-vegan-blaster - simple blaster game with python and pygame"
]
},
{
"cell_type": "markdown",
"id": "e5363834-a363-4313-9ba8-73a15855c68a",
"metadata": {},
"source": [
"I made a simple game with python and pygame \n",
"inspired by the classic Blasterman from Hudson-Soft.\n",
"\n",
"Thanks Kenney https://kenney.nl for the assets"
]
},
{
"cell_type": "markdown",
"id": "1a3ce75c-ed7c-483f-a295-716fc6205037",
"metadata": {},
"source": [
"
"
]
},
{
"cell_type": "markdown",
"id": "2106a9bb-7055-4725-a2f7-cc06c3c70dbe",
"metadata": {},
"source": [
"## From pygame to the browser"
]
},
{
"cell_type": "markdown",
"id": "3dd18b8a-beff-4a4d-b217-379350c7c46f",
"metadata": {},
"source": [
"You can convert a python pygame into an webassembly and play it in the browser."
]
},
{
"cell_type": "markdown",
"id": "e629058f-b87d-4baf-8c83-12b7448a9d37",
"metadata": {},
"source": [
"Install pygbag https://github.com/pygame-web/pygbag"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "df33cbec-11d4-4fbb-bbdf-8a764682db3d",
"metadata": {},
"outputs": [],
"source": [
"pip install pygbag"
]
},
{
"cell_type": "markdown",
"id": "a04bb914-82c6-4eb1-8665-b5f14738a63d",
"metadata": {},
"source": [
"You have to rename your game to main.py and make its loop async aware."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e748e315-fb25-40c2-9c6e-9338fcf06c31",
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"import random\n",
"\n",
"from wonderzero import *\n",
"\n",
"..\n",
"\n",
"async def main():\n",
" game = Game(width=WIDTH, height=HEIGHT, name='Vegan Blaster')\n",
" game.background_color = GRAY\n",
" await game.run_async()\n",
" game.quit()\n",
"\n",
"asyncio.run(main())"
]
},
{
"cell_type": "markdown",
"id": "359968c1-1422-4ddc-984e-3adae372d63e",
"metadata": {},
"source": [
"Compile to webassembly"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4dae1af5-5436-4e06-a917-b9cc592e598d",
"metadata": {},
"outputs": [],
"source": [
"pygbag ./folder"
]
},
{
"cell_type": "markdown",
"id": "50e49198-d3f6-406d-b08d-334ba26eac81",
"metadata": {},
"source": [
"You can play it.\n",
"Chrome should work. Use keyboard.\n",
"\n",
"soon on itch.io"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5c775a9e-bae4-4c99-86ad-1d5d6e294421",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Rust",
"language": "rust",
"name": "rust"
},
"language_info": {
"codemirror_mode": "rust",
"file_extension": ".rs",
"mimetype": "text/rust",
"name": "Rust",
"pygment_lexer": "rust",
"version": ""
}
},
"nbformat": 4,
"nbformat_minor": 5
}