Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
241 commits
Select commit Hold shift + click to select a range
6563dbb
Add Code Jam template.
jb3 Jul 9, 2021
d0762d4
Makes Precommit Manager Independent
HassanAbouelela Jul 10, 2021
c04c75f
Adds Project Manager Samples
HassanAbouelela Jul 10, 2021
3d5f617
Merge pull request #2 from python-discord/global-actions
HassanAbouelela Jul 10, 2021
17c5f86
Renames workflow to Lint
onerandomusername Jul 17, 2021
bb83538
Merge pull request #3 from onerandomusername/patch-1
HassanAbouelela Jul 17, 2021
63bbaa0
remove flake8 plugins
shenanigansd Jul 19, 2022
d0c694a
update Python version to 3.10
shenanigansd Jul 19, 2022
4b993de
update flake8 ignores
shenanigansd Jul 19, 2022
1c9a4d0
remove unused flake8 plugins from documentation
shenanigansd Jul 19, 2022
432b93a
remove removed flake8 codes from sample output
shenanigansd Jul 19, 2022
e5d557a
Update lint CI configuration for CJ9
ichard26 Jul 19, 2022
d1c92f6
only run workflow on commit to main branch
shenanigansd Jul 19, 2022
f1e9289
Bump linting tools as Kat suggested
ichard26 Jul 19, 2022
c49d624
Remove D100 from README since we're ignoring it anyway
ichard26 Jul 19, 2022
1ced0aa
Merge pull request #5 from python-discord/update-ci
janine9vn Jul 19, 2022
a926999
Hotfix: bump isort (5.10.1 -> 5.12.0)
ichard26 Aug 28, 2023
3e38115
Replace (and remove) broken images in README
ichard26 Aug 28, 2023
17c8122
Update pre-commit-hooks version
lemonyte Apr 3, 2024
5b70abb
Replace flake8 and isort with ruff
lemonyte Apr 4, 2024
6467281
Update Python version to 3.12
lemonyte Apr 4, 2024
95f2aa4
Update CI github actions
lemonyte Apr 4, 2024
7b0b37c
Clean up comments
lemonyte Apr 4, 2024
057f4d2
Rename LICENSE to LICENSE.txt
lemonyte Jun 25, 2024
bf560ad
Bump dependency versions
lemonyte Jun 25, 2024
a3b49ac
Update README
lemonyte Jun 25, 2024
c45ca52
Ignore redundant docstring lint rule
lemonyte Jun 25, 2024
298dfde
Bump Ruff to v0.5.0
lemonyte Jun 30, 2024
7c1b9c4
Add note about Poetry config
lemonyte Jul 7, 2024
d5fd7be
Merge pull request #8 from lemonyte/update-2024
lemonyte Jul 7, 2024
50f66ac
Update pre-commit hooks
lemonyte Jul 7, 2025
2547064
Bump pre-commit and ruff versions
lemonyte Jul 7, 2025
0a25b6b
Remove deprecated ruff rules
lemonyte Jul 7, 2025
806c16f
Replace requirements-dev.txt with dependency group
lemonyte Jul 7, 2025
168d100
Add authors field
lemonyte Jul 7, 2025
bc30ebf
Update readme
lemonyte Jul 7, 2025
8a98216
Merge pull request #9 from python-discord/update-2025
lemonyte Jul 7, 2025
15af701
filled in some blanks in pyproject.toml
fluffy-marmot Aug 6, 2025
3f9e8bf
Purge README
Ksenofanex Aug 7, 2025
570ee2c
Add fix flag to ruff precommit config
Ksenofanex Aug 7, 2025
f7dc224
Add fixes to ruff config and isort
Ksenofanex Aug 7, 2025
8835be7
Add e-mail to self
Ksenofanex Aug 7, 2025
df6a1d7
Merge ksenofanex config changes from fluffy-marmot/configs
fluffy-marmot Aug 7, 2025
b8eaaeb
started script to get horizons api data, small changes in pyproject.toml
fluffy-marmot Aug 9, 2025
21681c1
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 9, 2025
bf2dea1
script now gets coordinates of planets using today's date, also gets …
fluffy-marmot Aug 9, 2025
1a853d8
script now gets coordinates of planets using today's date, also gets …
fluffy-marmot Aug 9, 2025
fc98049
Made the pygame window and and "game"
Programmer-5090 Aug 9, 2025
623d271
I created the orbiting system but there's need for a lot of improveme…
Programmer-5090 Aug 10, 2025
5f84074
organize api and add models
TheRatLord Aug 10, 2025
ca4014d
disable COM812 rule
TheRatLord Aug 10, 2025
857e809
create parsers
TheRatLord Aug 10, 2025
fd43c45
modify script to use wrapper
TheRatLord Aug 10, 2025
73d175a
uv lock
TheRatLord Aug 10, 2025
4e09df7
big hot mess, but a simple example of animation loop in browser using…
fluffy-marmot Aug 10, 2025
32fcd2c
dark's thing in darkscript, still messy, needs lots of cleanup
fluffy-marmot Aug 10, 2025
755c041
ruff did some auto fixing
fluffy-marmot Aug 11, 2025
3685462
merge game-logic branch
fluffy-marmot Aug 11, 2025
3200de3
Merge branch 'main' into api-models
fluffy-marmot Aug 11, 2025
477e25e
Merge pull request #2 from fluffy-marmot/api-models
fluffy-marmot Aug 11, 2025
2021383
removed uv.lock, renamed horizons/ dir to horizons_data/, minor house…
fluffy-marmot Aug 11, 2025
f76819e
just added some comments to app.py and game.py
fluffy-marmot Aug 11, 2025
bd774a6
Added a scene class
Programmer-5090 Aug 11, 2025
5fb5e7e
added star system
spirledaxis Aug 12, 2025
f50491b
Merge branch 'Game-logic' of https://github.com/fluffy-marmot/codejam…
fluffy-marmot Aug 12, 2025
c5a3acd
merging stars into main
fluffy-marmot Aug 12, 2025
2884966
merged stars system and better planet numbers into main
fluffy-marmot Aug 12, 2025
ffce0d0
make stars start at with random shade and fade_in values
fluffy-marmot Aug 12, 2025
5d5d137
added reliable logger to browser console, mouse and keyboard event ha…
fluffy-marmot Aug 12, 2025
6be4e2f
added favicon.ico for browser tab icon
fluffy-marmot Aug 12, 2025
8766053
Merge branch 'Scene/Player'
fluffy-marmot Aug 12, 2025
494120c
merge scene and small fix
fluffy-marmot Aug 12, 2025
505713b
added player sprite
Programmer-5090 Aug 12, 2025
30a545d
easier sprite urls via window.sprites dictionary
fluffy-marmot Aug 12, 2025
49d268b
sprites dict refers to HTML image objects, not urls now
fluffy-marmot Aug 12, 2025
4f22c10
add get_bounding_box method to space mass and use it in render method
fluffy-marmot Aug 13, 2025
b787992
fix mouse coordinate events to use canvas's coord system
fluffy-marmot Aug 13, 2025
124c24b
detect planet clicks and refactor to use positions
TheRatLord Aug 13, 2025
c7173a3
ruff format
TheRatLord Aug 13, 2025
4e7819e
a few more ruff issues were shut up
TheRatLord Aug 13, 2025
53a8ff9
Added the player class and currently rendering on the screen to test it
Programmer-5090 Aug 13, 2025
65f1676
move dataclasses to common and more formatting changes
TheRatLord Aug 13, 2025
0ade1c6
Merge branch 'main' into planet-detection
TheRatLord Aug 13, 2025
4322dc8
can't import relative :(, will look into it later
TheRatLord Aug 13, 2025
6d02299
Merge pull request #3 from fluffy-marmot/planet-detection
fluffy-marmot Aug 13, 2025
c101bbe
modify Rect class so bottom/right are handled as properties and only …
fluffy-marmot Aug 13, 2025
ec4ecb6
removed player_sprite as this is already accessible as sprites[player…
fluffy-marmot Aug 13, 2025
8c9a5c8
oops
fluffy-marmot Aug 13, 2025
fc4b798
move player timekeeping of last frame from game.py to inside player c…
fluffy-marmot Aug 13, 2025
17597d3
decent start, some parts haven't been fully integrated but main scene…
fluffy-marmot Aug 13, 2025
f7a9984
scene switching is working
fluffy-marmot Aug 13, 2025
aa7589f
included WIP turtle's asteroid.py file
fluffy-marmot Aug 13, 2025
68b75b4
Added asteroids and its spawing. Tried adding collision but its not c…
Programmer-5090 Aug 13, 2025
98a57d4
highlight planet on hover
TheRatLord Aug 14, 2025
35d3fbb
add sprites wrapper, asteroids not covered yet
TheRatLord Aug 14, 2025
8f4c86a
minor fix to exclude asteroid sprites dir from sprites list
fluffy-marmot Aug 14, 2025
0adad67
add collision bumping player around and healthbar
fluffy-marmot Aug 14, 2025
886938b
planets start more random instead of perfect spiral
fluffy-marmot Aug 14, 2025
a5106f9
Couldn't do much just added rotation for player
Programmer-5090 Aug 15, 2025
41dff0a
added scanner
spirledaxis Aug 15, 2025
12bd21b
added bar icons
spirledaxis Aug 15, 2025
f519bbd
organize browser-side .py files into static/scripts/ folder
fluffy-marmot Aug 15, 2025
8390c7f
moved position methods to SceneObject
fluffy-marmot Aug 15, 2025
1280627
some minor refactoring, new debris system still getting tweaked
fluffy-marmot Aug 15, 2025
5ca1450
audio system, attributions file, better debris
fluffy-marmot Aug 15, 2025
ae30777
volume option for play_sound, clamp max debris size
fluffy-marmot Aug 15, 2025
636f1da
add planet names to highlighting
fluffy-marmot Aug 15, 2025
d488a35
minor refactor of reused code
fluffy-marmot Aug 15, 2025
9b1fbf5
hard mode activated
fluffy-marmot Aug 15, 2025
0147b7f
added buggy logic for planet completion
spirledaxis Aug 16, 2025
75583b5
move horizons_api
TheRatLord Aug 16, 2025
4a754ce
add pyscript tool
TheRatLord Aug 16, 2025
87f8d97
remove duplicate distance method
TheRatLord Aug 16, 2025
eedec0d
add basic result display # No sound yet
TheRatLord Aug 16, 2025
14cc5e1
move spritesheet scripts to tools
fluffy-marmot Aug 16, 2025
cd4e60a
add loading label while pyscript is loading
fluffy-marmot Aug 16, 2025
a3015cc
WIP on level select screen
fluffy-marmot Aug 16, 2025
499cf9e
create state class and fix planet completion display issue
TheRatLord Aug 16, 2025
d784663
Merge branch 'main' into restructure
TheRatLord Aug 16, 2025
e50c831
Merge pull request #4 from fluffy-marmot/restructure
fluffy-marmot Aug 16, 2025
37ef9d6
fix asteroid nums
fluffy-marmot Aug 16, 2025
bd87796
lower collision volume
fluffy-marmot Aug 16, 2025
8fedcef
added level info screen on clicking planets
fluffy-marmot Aug 16, 2025
98069f6
attempt to merge planet info overlays
fluffy-marmot Aug 16, 2025
7b0cd7e
fix my merge problems
fluffy-marmot Aug 16, 2025
fa774bf
smoother player disabling and scanner limits
TheRatLord Aug 16, 2025
fa3f018
bump asteroids away, add asteroid health and destruction
fluffy-marmot Aug 16, 2025
3135058
improve scanner visuals
TheRatLord Aug 16, 2025
26e3b7e
merge scanner changes
TheRatLord Aug 17, 2025
07c28e9
player invincible upon level completion
spirledaxis Aug 17, 2025
6bda095
why doesn't planet.complete work??
spirledaxis Aug 17, 2025
350d99f
made description more in theme
spirledaxis Aug 17, 2025
864a8c7
shh dont tell soosh i did anyhting
TheRatLord Aug 17, 2025
5d9a426
goodluck soosh
spirledaxis Aug 17, 2025
2052fb1
Merge https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 17, 2025
a88bb13
added starting scence with dialouge
spirledaxis Aug 17, 2025
cde59ad
simple one line fix
fluffy-marmot Aug 17, 2025
fcd90a7
removed API VERSION in info
spirledaxis Aug 17, 2025
ca02213
planet info fix
fluffy-marmot Aug 17, 2025
33e4583
load new attributes
TheRatLord Aug 17, 2025
e20cee7
Merge https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 17, 2025
a98fed2
User must now re-hold spacebar upon getting hit
spirledaxis Aug 17, 2025
6db64bf
structure for difficulty properties
fluffy-marmot Aug 17, 2025
b79f893
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 17, 2025
d33b713
better typing
TheRatLord Aug 17, 2025
186ef2a
merge with main
TheRatLord Aug 17, 2025
be24504
Merge branch 'main' into loading-attributes
TheRatLord Aug 17, 2025
67639f7
text refining: audio, centering option
fluffy-marmot Aug 17, 2025
62b9806
quick fix
fluffy-marmot Aug 17, 2025
c34b659
added some more audio and music
fluffy-marmot Aug 17, 2025
b2bc32c
level difficulties now affect gameplay, numbers may need tweaking
fluffy-marmot Aug 17, 2025
a0340b6
comment clarification
fluffy-marmot Aug 17, 2025
e557e53
add control tips for player
fluffy-marmot Aug 17, 2025
6e9600e
fix scanner sprite
fluffy-marmot Aug 17, 2025
96e1a3a
get rid of unicode arrow key characters
fluffy-marmot Aug 17, 2025
11adcb1
open json with utf-8 encoding
fluffy-marmot Aug 17, 2025
25c9e89
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
Programmer-5090 Aug 17, 2025
27169c6
Death Screen and explosion. Press k to insta die
Programmer-5090 Aug 17, 2025
78f6a05
added utf-8 encoding
spirledaxis Aug 17, 2025
928d096
added 3d stars in the start scence
spirledaxis Aug 17, 2025
991b414
Merge https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 17, 2025
b56de66
reset planet completions on player
Programmer-5090 Aug 17, 2025
ea6a912
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 17, 2025
5810bae
added max radius to 3d stars
spirledaxis Aug 17, 2025
0d928a1
fixed star scene
Programmer-5090 Aug 17, 2025
9ac1f3a
Merge https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 17, 2025
3347f81
fixed insta die error
Programmer-5090 Aug 17, 2025
7dd1522
removed print statement
spirledaxis Aug 17, 2025
768795e
added player to start scence
spirledaxis Aug 17, 2025
39f59b9
Merge https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 17, 2025
2334e18
jupiter g, earth repair, mercury dmg
fluffy-marmot Aug 17, 2025
85ea6ce
merge level interactions
fluffy-marmot Aug 17, 2025
2f29d0c
guys i can't get the lunar surface to look good i need help
Programmer-5090 Aug 17, 2025
5fd9851
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
Programmer-5090 Aug 17, 2025
b5b68d9
final scene started
Programmer-5090 Aug 17, 2025
84d80c0
lore added, with dramatic pauses for puncuation
spirledaxis Aug 18, 2025
2bd9a68
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 18, 2025
3945583
add button to death screen + minor
fluffy-marmot Aug 18, 2025
058121c
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 18, 2025
133f55b
add reqs
spirledaxis Aug 18, 2025
99ce4fc
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 18, 2025
2be98ed
Added the recycling items, and a slightly higher difficulty for earth
Programmer-5090 Aug 18, 2025
f2ff1d3
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
Programmer-5090 Aug 18, 2025
707e5fe
scan progress gets reduced when hit
Programmer-5090 Aug 18, 2025
b0008c2
explosion sound, refine music switching
fluffy-marmot Aug 18, 2025
559c83a
explosion sound, refine music switching
fluffy-marmot Aug 18, 2025
03513ed
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 18, 2025
795aa8c
removed puncuation pausing
spirledaxis Aug 18, 2025
1014d01
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 18, 2025
84c2b9f
moved player explosion class to player class
Programmer-5090 Aug 18, 2025
062c17f
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
Programmer-5090 Aug 18, 2025
096e8b0
disable health bar in intro
fluffy-marmot Aug 18, 2025
ee8340f
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 18, 2025
96d2628
remove player momentum on reset
fluffy-marmot Aug 18, 2025
f7ca03a
Escaping out of final scene
Programmer-5090 Aug 18, 2025
921b3ad
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
Programmer-5090 Aug 18, 2025
eb63d2e
Reduced earth difficulty
Programmer-5090 Aug 18, 2025
1d20f0a
add skip intro button, +attributions
fluffy-marmot Aug 18, 2025
ffecbaf
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 18, 2025
5d39d8d
externalize lore to txt file, disable scan loss (Sorry dark lol)
fluffy-marmot Aug 18, 2025
e3a92b2
add hint to text overlay
TheRatLord Aug 18, 2025
17a6ff3
add new music theme to intro (and plan for endscreen)
fluffy-marmot Aug 18, 2025
df65fbe
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
fluffy-marmot Aug 18, 2025
800f951
move text overlays to own file
TheRatLord Aug 18, 2025
d493003
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
TheRatLord Aug 18, 2025
76f22af
add attributions
fluffy-marmot Aug 18, 2025
ff5b5dc
set email in pyproject.toml
fluffy-marmot Aug 18, 2025
b177f85
add some docstrings and clean up scene descriptions file
fluffy-marmot Aug 18, 2025
eb3dcf1
swap button label when game completed
TheRatLord Aug 18, 2025
c22445c
update dependencies
TheRatLord Aug 18, 2025
6631158
fix author, update req.txt
TheRatLord Aug 18, 2025
8fb038d
fix author, update req.txt
TheRatLord Aug 18, 2025
840010e
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
spirledaxis Aug 18, 2025
6cb4f44
adjustable gravity in nudge_towards
spirledaxis Aug 18, 2025
c39b29a
centered scanner beam
spirledaxis Aug 18, 2025
5f26857
jupiter scans faster
spirledaxis Aug 18, 2025
d396037
spawning considers player position
spirledaxis Aug 18, 2025
0b58dde
add scrolling credits
TheRatLord Aug 18, 2025
3091641
Merge branch 'main' of https://github.com/fluffy-marmot/codejam2025
TheRatLord Aug 18, 2025
cd19640
color star functionality
fluffy-marmot Aug 18, 2025
1db698c
Merge remote-tracking branch 'origin/main' into colored-stars
fluffy-marmot Aug 18, 2025
6a6dd60
credits
fluffy-marmot Aug 18, 2025
1723966
Merge branch 'colored-stars'
fluffy-marmot Aug 18, 2025
a8da8b1
change credits music track
fluffy-marmot Aug 18, 2025
626caa0
added 'cheats' info for judges convenience
fluffy-marmot Aug 18, 2025
df7ae15
delete requirements.txt, using alternates
fluffy-marmot Aug 18, 2025
8208e0b
increased player speed and increased player hp after every planet com…
Programmer-5090 Aug 18, 2025
3d94ea1
fix hp overflow
fluffy-marmot Aug 18, 2025
b1462f3
ok its safe enough...
fluffy-marmot Aug 18, 2025
2341de5
change music attribution to preferred
fluffy-marmot Aug 18, 2025
52ec6fc
quick readme notes
fluffy-marmot Aug 19, 2025
288d259
readme rough draft
spirledaxis Aug 21, 2025
daf0fc3
readme second draft
spirledaxis Aug 21, 2025
f2c2ba7
Update README.md with installation and usage steps
TheRatLord Aug 21, 2025
9c3c107
added yt link
spirledaxis Aug 22, 2025
2b36bcf
work on readme, add screenshots
fluffy-marmot Aug 22, 2025
1f90982
work on readme, add screenshots
fluffy-marmot Aug 22, 2025
0fc2770
merge
fluffy-marmot Aug 22, 2025
d0a6e58
readme stuff
fluffy-marmot Aug 22, 2025
6e8dfa6
add some code examples to readme
fluffy-marmot Aug 22, 2025
be8b74c
Add 'cool-cacti/' from commit '6e8dfa63e83a5ebe644dbc66b5c559f7144c3e3c'
janine9vn Sep 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions cool-cacti/.github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# GitHub Action workflow enforcing our code style.

name: Lint

# Trigger the workflow on both push (to the main repository, on the main branch)
# and pull requests (against the main repository, but from any repo, from any branch).
on:
push:
branches:
- main
pull_request:

# Brand new concurrency setting! This ensures that not more than one run can be triggered for the same commit.
# It is useful for pull requests coming from the main repository since both triggers will match.
concurrency: lint-${{ github.sha }}

jobs:
lint:
runs-on: ubuntu-latest

env:
# The Python version your project uses. Feel free to change this if required.
PYTHON_VERSION: "3.12"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.1
39 changes: 39 additions & 0 deletions cool-cacti/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
horizons_data/*
!horizons_data/template.json
!horizons_data/planets.json

# Files generated by the interpreter
__pycache__/
*.py[cod]

# Environment specific
.venv
venv
.env
env

# Unittest reports
.coverage*

# Logs
*.log

# PyEnv version selector
.python-version

# Built objects
*.so
dist/
build/

# IDEs
# PyCharm
.idea/
# VSCode
.vscode/
.VSCodeCounter/
# MacOS
.DS_Store

# Ruff check
.ruff_cache/
19 changes: 19 additions & 0 deletions cool-cacti/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Pre-commit configuration.
# See https://github.com/python-discord/code-jam-template/tree/main#pre-commit-run-linting-before-committing

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
hooks:
- id: ruff-check
args: [ --fix ]
- id: ruff-format
30 changes: 30 additions & 0 deletions cool-cacti/ATTRIBUTIONS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Music: "25 oh 20 and to the stars", "something about space", "death screen clip"
Composed and created by Elemeno Peter https://kimeklover.newgrounds.com/
Licensed under CC BY-NC-SA

Planet sprites generated with Pixel Planet Generator by Deep Fold
https://deep-fold.itch.io/pixel-planet-generator
Software licensed under the MIT License

Explosion sprites by LinkNinja
https://linkninja.itch.io/simple-explosion-animation
Licensed under CC-0

Recycle items art by Clint Bellanger
https://opengameart.org/content/recycle-items-set
Licensed under CC-BY 3.0

QR Code Scanner
https://www.hiclipart.com/free-transparent-background-png-clipart-pjnbg
HiClipart is an open community for users to share PNG images, all PNG cliparts in HiClipart are for Non-Commercial Use

3 Explosion Bangs Copyright 2012 Iwan 'qubodup' Gabovitch <http://qubodup.net>
https://opengameart.org/content/3-background-crash-explosion-bang-sounds
Licensed under CC-BY 3.0

Rock breaking sound
https://opengameart.org/content/rockbreaking
Licensed under CC-BY 3.0

Scan sound from https://www.zapsplat.com
Use with attribution
7 changes: 7 additions & 0 deletions cool-cacti/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2021 Python Discord

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
132 changes: 132 additions & 0 deletions cool-cacti/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Planet Scanners: Python Discord Code Jam 2025

We created a simple sprite-based, space-themed game using PyScript backed by Pyodide and its JavaScript wrapper
capabilities to leverage JavaScript's convenient API for rendering graphics on HTML canvas elements, playing
audio, and accessing user input. We hope this can demo as an alternative to the use of a pygame wrapper such as
pygbag, without the need for its extra layer of abstraction, as the browser-side execution of our game doesn't use anything
but the Python standard library and the PyScript and Pyodide modules for accessing JavaScript functionality.

### The Game

The introduction depicts aliens flying around space past the speed of light, about to turn on their super
advanced intergalactic planet scanner. Today, it fails! Luckily, one of the aliens has an old Earth-based
barcode scanner - the "wrong tool for the
job" - that will have to do today. In the solar system overview screen, seen below, the player can select each of the solar system's planets in turn and must complete
a scan for that planet to complete a mission.

![Planet selection screen](/readme_images/game1.png)

The gameplay (shown in the image below) is a variation of the classic asteroids game, where
the player must dodge incoming asteroids to avoid ship damage and stay immobile while holding down the Spacebar
to progress scanning.
An animated rotating planet combined with the movement of stars off-screen in the opposite direction creates a
simple but effective perspective of the player ship orbiting a planet.

![Planet selection screen](/readme_images/game2.png)

![Planet selection screen](/readme_images/game3.png)

## Intended Event Frameworks

We used PyScript backed by the Pyodide interpreter. We were pleasantly surprised by how few PyScript-specific
oddities we ran into. Using the provided JavaScript wrapper capabilities felt almost as natural as writing
JavaScript directly into the Python files, except writing in Python! To serve our single-page game app, we
included an ultra-minimalistic Flask backend for convenience in designing, though with a little refactoring our page could
also be served statically. There is some very minimalistic HTML and CSS to more or less create an HTML canvas to
draw on with the appropriate styling and create the initial setup for importing our in-browser Python scripts.
It was necessary to provide the contents of a [PyScript.json](/static/PyScript.json) file to the config attribute of the <py-script> tag
of our [index.html](/templates/index.html) to let the PyScript environment allow the proper imports of modules
into one another.

One of the few things that adds a bit of awkwardness is needing to wrap function references passed to to JS callbacks by
using `create_proxy`, instead of passing a reference to the `game_loop` function directly:
```py
from Pyodide.ffi import create_proxy

def game_loop(timestamp: float) -> None:
...

game_loop_proxy = create_proxy(game_loop)
window.requestAnimationFrame(game_loop_proxy)
```

On the other hand, "writing JavaScript" in Python can feel very elegant sometimes. A CanvasRenderingContext2D's
drawing methods for
example often take a lot of arguments to define the coordinates of objects being draw. There's heavy use of
rectangular bounds given as four parameters: left, top, width, height. Defining a Python Rect class implementing
the iterator protocol...

```py
@dataclass
class Rect:
left: float
top: float
width: float
height: float

def __iter__(self) -> Iterator[float]:
yield self.left
yield self.top
yield self.width
yield self.height
```

...allows for some drawing calls to be very succinct with unpacking:

```py
# sprite_coords = Rect(0, 0, sprite_width, sprite_height)
# dest_coords = Rect(dest_left, dest_top, dest_width, dest_height)
ctx.fillRect(*dest_coords)
ctx.drawImage(sprite_image, *sprite_coords, *dest_coords)
```

## Installation and Usage

### Prerequisites to Run
- Python 3.12
- [uv](https://github.com/astral-sh/uv) is recommended for the package manager
- An active internet connection (to fetch the Pyodide interpreter and PyScript modules from the PyScript CDN)
### Installation
1. Clone the repository:
```bash
git clone https://github.com/fluffy-marmot/codejam2025
```

2. Install dependencies using uv:
```bash
uv sync
```
### Without uv
The dependencies are listed in [`pyproject.toml`](pyproject.toml). Since the only server-side dependency for running the
project is flask (PyScript is obtained automatically in browser as needed via CDN), the
project can be run after cloning it by simply using
```bash
pip install flask
python app.py
```
### Running the Game
Running the [app.py](/app.py) file starts the simple flask server to serve the single html page, which should be at
[http://127.0.0.1:5000](http://127.0.0.1:5000) if testing it locally. We also have a version of our game hosted
at [https://caius.pythonanywhere.com/codejam/](https://caius.pythonanywhere.com/codejam/) although this has been
slightly modified from the current repository to run as a single app within an already existing Django project.
None of the files in the `/static/` directory of the hosted version have been modified, therefore in-browser functionality
should be the same.

## Individual Contributions

RealisticTurtle: storyboarding, intro scene and story, game scene, star system, scanning mechanics

Soosh: library research, core functionality (audio and input modules, gameloop, scene system), code integration, debris
system

Dark Zero: planet selection scene, sprites, spritesheet helper scripts, player mechanics, asteroid
implementation, collision logic, end scene

Doomy: dynamic textboxes, end scene and credits, Horizons API functionality,
refactoring and maintenance, scanner refinement, experimented with Marimo

## Game Demonstration

This video is a quick demonstration of our game and its mechanics by our teammate RealisticTurtle

View the demo on [Youtube](https://www.youtube.com/watch?v=J8LKGUsTeAo)
46 changes: 46 additions & 0 deletions cool-cacti/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import json
from pathlib import Path

from flask import Flask, render_template

"""
using a flask backend to serve a very simple html file containing a canvas that we draw on using
very various pyscript scripts. We can send the planets_info variable along with the render_template
request so that it will be accessible in the index.html template and afterwards the pyscript scripts
"""
app = Flask(__name__)

base_dir = Path(__file__).resolve().parent
static_dir = base_dir / "static"
sprite_dir = static_dir / "sprites"
audio_dir = static_dir / "audio"

# contains various information and game data about planets
with Path.open(base_dir / "horizons_data" / "planets.json", encoding='utf-8') as f:
planets_info = json.load(f)

# create a list of available sprite files
sprite_list = [sprite_file.stem for sprite_file in sprite_dir.iterdir() if sprite_file.is_file()]

# create a list of available audio files
audio_list = [audio_file.name for audio_file in audio_dir.iterdir()]

with Path.open(static_dir / "lore.txt") as f:
lore = f.read()

with Path.open(static_dir / "credits.txt") as f:
credits = f.read()

@app.route("/")
def index():
return render_template(
"index.html",
planets_info=planets_info,
sprite_list=sprite_list,
audio_list=audio_list,
lore=lore,
credits=credits
)

if __name__ == "__main__":
app.run(debug=True)
Loading