Games
Games written in Python with kaypy, running in your browser. Each one is a
single HTML file — the whole game, the sprites, and Python itself — built with
kaypy web.
Remix it in the playground opens a game's code in the playground, ready to run. Change a number, swap a picture, draw a new level — then press Run and play your own version. If you've already written something in the playground, it asks before replacing it.
Ghost Chase
Arrow keys to move, or hold the mouse (or your finger) where you want Bean to go. Click the picture first so the keys reach it.
Play Ghost Chase → · Read the code on GitHub → · Remix it in the playground →
Grab every coin before the ghosts grab you. Bean is faster than they are, but they never stop coming.
It is the easiest game here, written for students who have not got to
functions yet: variables, if, a for loop and a
list. The ghosts are one word, follow(), which chases Bean with
no code of ours at all.
How it was built, step by step →
Bomb Dodge
Left and right arrows to move, or hold the mouse (or your finger) where you want Bean to go. Click the picture first so the keys reach it.
Play Bomb Dodge → · Read the code on GitHub → · Remix it in the playground →
Bombs fall from the sky. Every one that lands on the grass instead of on Bean is a point, and the more points you have, the faster they fall and the more of them there are. One hit and it's over. Your best score is remembered.
It is the one to try after Ghost Chase, and the first that writes functions of its own: about two hundred lines, most of them comments. There are no levels and no physics — each bomb moves itself down a little every frame and checks how far it is from Bean. How it was built, step by step →
Goblin Hit
Click the monsters, or tap them, before they duck back down.
Play Goblin Hit → · Read the code on GitHub → · Remix it in the playground →
Monsters pop up out of nine holes. Every kind is worth something different, and the quick ones are worth the most. Don't click the angel. After thirty seconds you see what you hit, and your best score is remembered.
It is the one for after dictionaries, and comes between Bomb Dodge and Log Hacker. Every monster's name is the key that looks up its picture, its points and how long it stays up, so adding a monster of your own is one line in each dictionary. How it was built, step by step →
Log Hacker
Click a word to guess the password, or tap it. There is no clock.
Play Log Hacker → · Read the code on GitHub → · Remix it in the playground →
You have broken into a server. One of the words on the left is its password, and you have four tries to find it.
How to play:
- Click any word to guess it. To begin with, every word is as likely as any other.
- A wrong guess goes in the log on the right, with how many of its letters
are the right letter in the right place.
clock 2/5means two of its letters are exactly where the password has them. - Use that to rule words out. The password must score the same against
every guess in the log. If
clockgot 2, thentrackcould be it (it matches clock in exactly two places, theck), butcrashcan't (it matches in only one). - Guess one of the words that's left. Each new line in the log narrows it down further.
- Get it in four tries and you're in: ACCESS GRANTED, and on to the next server, with more words and, every two servers, a longer password. Use up your four tries and you're locked out. The most servers you got into is remembered.
It is the one for after files, and comes
between Goblin Hit and Paddle Ball. The game writes three files for every
server — words.txt, password.txt and
log.txt — and reads them back, opening every one with
with open(...). Each guess is added to the end of the log with
"a".
How it was built, step by step →
Paddle Ball
Left and right arrows to move your paddle, or hold the mouse (or your finger) where you want it. Click the picture first so the keys reach it.
Play Paddle Ball → · Read the code on GitHub → · Remix it in the playground →
Pong for one player. The ball bounces off the top and the sides, and you keep it up with a paddle along the bottom. Every hit is a point and makes the ball a little faster. Miss it and it's over. Your best score is remembered.
It is the step between Bomb Dodge and Pong. It is built the way Bomb Dodge is, with one new idea: the ball carries its own speed, and bouncing is just making that speed negative. How it was built, step by step →
Spiral Storm
Arrow keys to move, or hold the mouse (or your finger) where you want Bean to go. Click the picture first so the keys reach it.
Play Spiral Storm → · Read the code on GitHub → · Remix it in the playground →
A bullet hell. The Gazer swings along the top and fills the sky with bullets: shots aimed straight at Bean, then rings, then a spiral that never stops turning. Every second you last is a point. One hit and it's over. Your best score is remembered.
It comes between Paddle Ball and Pong, and it is built the way Bomb Dodge
is. The camera zooms out to make room for a hundred bullets, and each bullet
flies by itself with move(): a ring is a for loop
over angles, and a spiral is one angle that keeps turning.
How it was built, step by step →
Pong
Up and down arrows to move your paddle, or hold the mouse (or your finger) where you want it. Click the picture first so the keys reach it.
Play Pong → · Read the code on GitHub → · Remix it in the playground →
You against the computer. Every hit makes the ball a little faster, and where it meets your paddle decides where it goes: the middle sends it straight, the ends send it off at an angle — which is how you get it past the computer. First to 7 wins.
There are no pictures at all: the paddles, the ball and the net are rectangles. The ball is a game object that carries its own speed, and turning it round is just making that speed negative. How it was built, step by step →
Flappy Bean
Space or click to flap. Don't touch anything.
Play Flappy Bean → · Read the code on GitHub → · Remix it in the playground →
The pipes are plain rectangles, so there is no artwork to find and every number that shapes the game — the gap, the gravity, how hard a flap pushes — sits in one block at the top, ready to be argued about. How it was built, step by step →
Coin Rush
Arrow keys to run. Click the picture first so the keys reach it.
Play Coin Rush → · Read the code on GitHub → · Remix it in the playground →
Bean has thirty seconds to grab every coin on the level. Get them all and the next level starts with more in the way — walls, then spikes, then floating ghosts, then a gazer that follows you straight through the walls. Touch anything that hurts and you lose three seconds and start again from where you began. Clear all five levels and they come round again with less time on the clock, so the game only ends when the clock wins. Your best score is remembered.
It is written to be copied. There are no list comprehensions and nothing
clever: the levels are pictures made of letters, where a # is a
wall, an o is a coin and a ^ is a spike, and every
function it calls is on the API page.
How it was built, step by step →
Coin Dash
Left and right to run, up or space to jump. Click the picture first so the keys reach it.
Play Coin Dash → · Read the code on GitHub → · Remix it in the playground →
Bean, one room, one coin, and red blocks dropping in through the gap in the ceiling. Grab the coin and it pops up somewhere else; the higher your score, the faster the red blocks come. Touch one, or fall through the gap in the floor, and it is over. Your best score is remembered.
Like Coin Rush it is written to be copied: no list comprehensions, the room is a picture made of letters, every function it calls is on the API page, and every picture and sound comes with the playground, so the whole file can be pasted in there and run. The red blocks have no special code for walls — each frame one asks whether it actually got anywhere since the last, and if it did not, something is in the way and it turns round. How it was built, step by step →
Dark Blue
Left and right to run, up to jump (hold it to jump higher). Click the picture first so the keys reach it.
Play Dark Blue → · Read the code on GitHub → · Remix it in the playground →
Five levels of jumping, coins and red things. Collect every coin to move on; touch lava or a moving red block, or fall off the bottom, and the level starts again. The game counts how many times you died and remembers your fewest. Press down on the menu to pick a level. Based on Dark Blue by Thomas Palef.
The levels are pictures made of letters, a hundred tiles wide, and the camera follows Bean along them. Every function it calls is on the API page. How it was built, step by step →
Spike Runner
Space, up or click to jump; hold it to keep jumping. Click the picture first so the keys reach it.
Play Spike Runner → · Read the code on GitHub → · Remix it in the playground →
The cube runs by itself; all you do is jump. Over spikes, onto blocks, across gaps, and off yellow orbs for a second jump in mid-air: hold jump as you go through one. One touch and you're back at the start of the level, with the attempt count going up. Six levels, each a little harder than the last. The bar at the top shows how far you got, and your best is remembered. In the style of Geometry Dash.
Each level is a row of short sections, each a picture made of letters, joined end to end — so a new obstacle is a new section. Every function it calls is on the API page. How it was built, step by step →
Block Slide
Drag a block left or right — with your finger on a phone or tablet, or the mouse on a computer.
Play Block Slide → · Read the code on GitHub → · Remix it in the playground →
Slide a block along its row, and anything with nothing underneath falls. A row with no gaps disappears, like Tetris, and clearing two at once scores four times as much. After every move a new row pushes up from the bottom, so the board keeps filling. Push a block over the top and it's over. Your best score is remembered.
Made for touch: it stands upright like a phone, and a finger is all it needs. There are no game objects in it at all — every block is a dictionary in a list, and the board is drawn from that list every frame. How it was built, step by step →
Knight's Hall
A d-pad and two buttons on the screen — thumbs on a phone or tablet, the arrow keys, space and z on a computer.
Play Knight's Hall → · Read the code on GitHub → · Remix it in the playground →
Monsters come through the doors of a hall, in waves that keep growing: goblins, then fast imps, then orcs that take three hits. Walk in eight directions, swing your sword the way you're facing, and dash straight through a monster when you're cornered. Now and then one drops a flask that gives a heart back. Your best score is remembered.
Made for a phone held upright, like a handheld game: the hall on top and
the controls underneath, where your thumbs don't cover anything. The d-pad
is one word, joystick=True, and it pretends to be the arrow
keys, so the game itself is ordinary keyboard code.
How it was built, step by step →
Pop Drop
Left and right arrows to turn the launcher, space to fire. On a phone, the d-pad and the button do the same.
Play Pop Drop → · Read the code on GitHub → · Remix it in the playground →
Apples, beans, coins, eggs and more hang from the ceiling in a honeycomb. Fire one up at them: it bounces off the walls and sticks where it lands. Three of a kind touching pop, and anything left with nothing holding it up falls off too. Every shot that pops nothing fills the danger meter, and when it's full the ceiling comes down a row. Steel never pops — cut away what it hangs from. Each level adds a new kind of piece. Your best score is remembered.
A game in the style of the classic Snood. Finding which pieces touch, and
which are still hanging on, is a flood fill: a list of places still
to look, and a while loop that keeps going until it is empty.
How it was built, step by step →
Garden Guard
Click or tap: a plant card, then a square of lawn. Tap the suns to collect them. Best on a computer, or a tablet or phone held sideways.
Play Garden Guard → · Read the code on GitHub → · Remix it in the playground →
Zombies are walking across the lawn towards your house. Collect the suns that fall from the sky and spend them on plants: pineapples make more sun, beans shoot peas down their row, and each of the eight levels brings something new — a brock for a wall, a bomb, an onion whose icy peas slow zombies down, then skeletons, ice zombies the onion can't slow, and an ogre that takes sixty peas. Each row's lawnmower saves you once. The level you reached is remembered.
A game in the style of Plants vs. Zombies. Every plant, zombie, pea and sun is a game object that carries a few values of its own, and the levels are a list you can add to. How it was built, step by step →
Turn-Based Battle
Up and down to move the cursor, space to choose, x to go back. Click the picture first so the keys reach it.
Play Turn-Based Battle → · Read the code on GitHub → · Remix it in the playground →
The knight on the right, three monsters on the left, and the four commands every old role-playing game had: Attack, Magic, Item, Run. Everyone takes a turn in speed order, fastest first, and the round repeats until one side is finished.
A proof of concept rather than a whole game — one battle, win or lose. It is here because of how it is written: there is not a single game object in it. Every fighter is a dictionary and the screen is drawn from them each frame. How it was built →
Dungeon Dash
Arrow keys to run, space to jump, x to dash.
Play Dungeon Dash → · Read the code on GitHub → · Remix it in the playground →
Five rooms and a boss. Collect every coin in a room and the door opens, and each door hands you a new move: a double jump, then a dash, then a wall jump. The next room always has one coin you cannot reach without the move you were just given, so the thing you have learned is the thing you immediately need.
The levels are pictures. Each one is twenty characters wide and thirteen
tall, and a # is a wall, an o is a coin, a
g is a goblin. Moving a coin means moving an o.
How it was built, step by step →
Dino Quest
Arrows or WASD to walk, Z for the sword, space to talk to a villager.
Play Dino Quest → · Read the code on GitHub →
A top-down adventure across two villages, where the villagers ask you questions. Answer one right and it never comes back; answer it wrong and the same villager asks you again next time. The questions come from a JSON file on the web, so the same game can be a different quiz every week — which is the point of it. Enter the quiz code at the start, or leave the box empty for the practice questions.
Send in a game
If you have built something with kaypy, it can go on this page.
What to send: a link to the game already playable on the web — the page,
not the source. kaypy web game.py makes the one file you need; upload it to
itch.io, GitHub Pages, Netlify, or anywhere that serves a page.
What gets put up: anything that runs, is yours, and is fit for a classroom. Games get played before they go up, so allow a few days.
If you are a student: ask your teacher first.