Pixel Runner¶
Clear Code’s Pygame endless runner, with Timer signals, flipbook sprites and synthesised audio.
▶ Run in browserUpstream: https://github.com/clear-code-projects/UltimatePygameIntro
Licence: this port's own code is offered under MIT, not the SimVX Examples Licence the rest of the gallery carries. See ATTRIBUTION.md for the upstream it re-implements, the terms of anything it bundles, and the credit each one requires.
Ports live in the repository only, not in the simvx-examples distribution, because each is a derivative work licensed individually against the game it re-implements. Read it with git clone https://git.simvx.com/simvx/simvx.
Tags: port tier-0
Pixel Runner: SimVX Port¶
Faithful port of Clear Code’s Ultimate Pygame Intro endless runner to SimVX.
What it demonstrates¶
The whole game is one root node (nodes/runner.py) holding two states, the title
screen and the run, exactly as the upstream tutorial does. Along the way it shows
how the pygame idioms the tutorial teaches map onto engine features:
Pygame |
SimVX |
|---|---|
|
|
|
child nodes + |
|
a |
swapping |
|
|
|
|
|
|
|
|
|
a fixed 800x400 surface |
|
|
one named action per verb, carrying key, tap and pad |
Run¶
simvx examples run ports_ultimate_pygame_intro # interactive
simvx examples run ports_ultimate_pygame_intro --test # headless capture
Controls¶
Input |
Action |
|---|---|
|
Jump |
|
Start / restart after death |
|
Quit |
The game has one verb, so the whole screen is the jump button on a phone rather
than a drawn on-screen pad, which would cover part of a short play area to draw
a single control. nodes/runner.py declares all three actions in
Runner.input_context, so they are in force while the runner is mounted: nothing
is registered from main(), where InputMap has no tree yet.
Tests¶
uv run --package simvx-core pytest examples/ports/ultimate_pygame_intro/tests
Web export¶
simvx export web main.py -o pixel_runner.html
Asset licence¶
No upstream assets are bundled (the upstream repository declares no licence).
Character and enemy sprites and the ground tiles are from Kenney’s CC0
Platformer Art Complete Pack (https://kenney.nl / https://opengameart.org/content/platformer-art-complete-pack-often-updated),
resized to the original port geometry. The sky is generated, and all audio is
synthesised at load time (nodes/audio.py): the music loop through the engine’s
AudioSynth, the jump chirp as a swept sine fed to AudioClip.from_pcm.
See ATTRIBUTION.md and LICENSE (MIT).
Source files¶
File |
Summary |
Lines |
|---|---|---|
Pixel Runner: Clear Code’s Pygame endless runner, with Timer signals, flipbook sprites and synthesised audio. |
56 |
|
Pixel Runner: SimVX port package. |
1 |
|
Pixel Runner port: node modules. |
1 |
|
Where the port’s bundled art lives. |
10 |
|
Procedural audio: built on the engine’s AudioSynth API. |
103 |
|
Obstacle nodes: replaces Pygame |
80 |
|
Player node: replaces Pygame |
141 |
|
Pixel Runner: root scene replacing the pygame |
290 |
Source¶
1#!/usr/bin/env python3
2# /// script
3# requires-python = ">=3.14"
4# dependencies = ["simvx-core", "simvx-graphics", "numpy", "pillow"]
5# ///
6
7# /// simvx
8# tags = ["port", "tier-0"]
9# upstream = "https://github.com/clear-code-projects/UltimatePygameIntro"
10# web = { width = 800, height = 400, responsive = true }
11# ///
12"""Pixel Runner: Clear Code's Pygame endless runner, with Timer signals, flipbook sprites and synthesised audio.
13
14Run::
15
16 simvx examples run ports_ultimate_pygame_intro
17 simvx examples run ports_ultimate_pygame_intro --test # headless capture
18
19Web export::
20
21 simvx export web main.py -o pixel_runner.html
22"""
23
24import os
25import sys
26
27_HERE = os.path.abspath(os.path.dirname(__file__))
28
29from nodes.runner import Runner # noqa: E402
30
31from simvx.graphics import App # noqa: E402
32
33WIDTH, HEIGHT = 800, 400
34
35
36def main():
37 if "--test" in sys.argv:
38 from pathlib import Path
39
40 from simvx.graphics import save_png
41
42 capture_at = [30, 60, 120]
43 app = App(title="Pixel Runner", width=WIDTH, height=HEIGHT, visible=False)
44 frames = app.run_headless(Runner(), frames=130, capture_frames=capture_at)
45 out_dir = Path(_HERE) / "screenshots"
46 out_dir.mkdir(exist_ok=True)
47 for idx, img in zip(capture_at, frames, strict=False):
48 out_path = out_dir / f"frame_{idx}.png"
49 save_png(img, out_path)
50 print(f"saved {out_path}")
51 else:
52 App(title="Pixel Runner", width=WIDTH, height=HEIGHT).run(Runner())
53
54
55if __name__ == "__main__":
56 main()