\
🏠 Home
\
🎮 Gallery
\
➕ Create Game
\
📚 Docs
\
⚠️ Reports
\
Create a Python Game
<- Home
Run Game
Stop
Publish
Arcade
Puzzle
Action
Platformer
Other
Python Code
Ctrl+Enter to run
import game_api import random # A simple bouncing ball game game = game_api.Game(400, 400, "Bouncing Ball") # Game state ball_x = 200 ball_y = 200 ball_dx = 3 ball_dy = 2 ball_radius = 15 def update(): global ball_x, ball_y, ball_dx, ball_dy # Move the ball ball_x += ball_dx ball_y += ball_dy # Bounce off walls if ball_x - ball_radius <= 0 or ball_x + ball_radius >= 400: ball_dx *= -1 if ball_y - ball_radius <= 0 or ball_y + ball_radius >= 400: ball_dy *= -1 def draw(): game.clear() # Draw the ball game.draw_circle(ball_x, ball_y, ball_radius, "cyan") # Instructions game.draw_text("Watch it bounce!", 110, 380, "gray") # Start the game game.set_update(update) game.set_draw(draw) game.run(60)
Ready. Hit "Run Game" or press Ctrl+Enter to start.
Preview
Your game will appear here
Run
Reset Example
Python 3 via Pyodide - Have fun!
0 characters