| Element | Description |
|---|---|
| ๐ฏ Goal | Shoot rockets at floating FARTCOINs (green clouds) |
| ๐ Levels | Stinky Easy โ Putrid โ Horrid |
| ๐งจ Effect | On hit, FARTCOIN releases gas, floats downward, score increases |
| ๐ซ Player | Little Bean (rocket shooter) |
| ๐ฉ Enemy | FARTCOIN (hovering stink balloon) |
๐งช Starter Code
python
import pygame, random, sys
pygame.init()
# Screen setup
WIDTH, HEIGHT = 800, 600
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Little Bean vs. FARTCOIN")
# Load images
bean_img = pygame.Surface((50, 50))
bean_img.fill((200, 100, 50)) # Brown bean
fartcoin_img = pygame.Surface((60, 60))
fartcoin_img.fill((0, 255, 0)) # Smelly green blob
rocket_img = pygame.Surface((10, 20))
rocket_img.fill((255, 0, 0))
# Sound placeholder
fart_sound = pygame.mixer.Sound(pygame.mixer.Sound.buffer(b'\x00'*100))
# Game variables
clock = pygame.time.Clock()
bean_rect = bean_img.get_rect(midbottom=(WIDTH//2, HEIGHT-10))
rockets = []
fartcoins = []
score = 0
level = 1
font = pygame.font.SysFont(None, 36)
def spawn_fartcoins():
for i in range(3 + level):
x = random.randint(100, WIDTH - 100)
y = random.randint(50, 200)
fartcoins.append(fartcoin_img.get_rect(center=(x, y)))
spawn_fartcoins()
# Game loop
running = True
while running:
screen.fill((30, 30, 30))
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT: bean_rect.x -= 40
if event.key == pygame.K_RIGHT: bean_rect.x += 40
if event.key == pygame.K_SPACE:
rocket = rocket_img.get_rect(midbottom=bean_rect.midtop)
rockets.append(rocket)
# Update rockets
for rocket in rockets[:]:
rocket.y -= 10
if rocket.y < 0:
rockets.remove(rocket)
# Collision check
for fartcoin in fartcoins[:]:
for rocket in rockets[:]:
if fartcoin.colliderect(rocket):
fart_sound.play()
fartcoin.y += 40 # "Release gas" effect
score += 10
rockets.remove(rocket)
if fartcoin.y > HEIGHT - 100:
fartcoins.remove(fartcoin)
# Level progression
if not fartcoins:
level += 1
spawn_fartcoins()
# Draw elements
screen.blit(bean_img, bean_rect)
for rocket in rockets: screen.blit(rocket_img, rocket)
for fartcoin in fartcoins: screen.blit(fartcoin_img, fartcoin)
# HUD
screen.blit(font.render(f"Score: {score}", True, (255, 255, 255)), (10, 10))
screen.blit(font.render(f"Level: {level} ({['Stinky Easy','Putrid','Horrid'][min(level-1,2)]})", True, (255, 255, 0)), (10, 40))
pygame.display.flip()
clock.tick(60)
๐งจ How You Can Expand This
- ๐จ Add fart cloud animations using
.pngtransparency - ๐ต Drop in real sound files like
fart1.wav,rocket_launch.wav - ๐ง Add symbolic cues like โBean resonance levels risingโ or โCrane threads react!โ
- ๐ฏ Track high scores or community rankings
- ๐ Build unlockable rockets (Tofu Blaster? Espresso Beam?)
๐ Project Setup
๐ Files You’ll Need
index.htmlโ structure and canvasstyles.cssโ layout & flairgame.jsโ logic for Bean, FARTCOIN, and rockets- Optional: fart sound effects like
fart.mp3,explosion.mp3
๐งฑ index.html
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Little Bean vs. FARTCOIN</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Little Bean vs. FARTCOIN ๐ฅ๐จ</h1>
<canvas id="gameCanvas" width="800" height="600"></canvas>
<script src="game.js"></script>
</body>
</html>
๐จ styles.css
css
body {
text-align: center;
background-color: #222;
color: #fff;
font-family: 'Comic Sans MS', cursive;
}
canvas {
border: 4px dashed limegreen;
background: radial-gradient(circle at center, #3a3a3a 0%, #1a1a1a 100%);
}
๐ง game.js
javascript
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
let bean = { x: 375, y: 550, width: 50, height: 50 };
let rockets = [];
let fartcoins = [];
let score = 0;
let level = 1;
const levels = ["Stinky Easy", "Putrid", "Horrid"];
const fartImg = new Image();
fartImg.src = "https://via.placeholder.com/60x60/00ff00/000000?text=๐จ";
function spawnFartcoins(num) {
fartcoins = [];
for (let i = 0; i < num; i++) {
fartcoins.push({ x: Math.random() * 740, y: Math.random() * 150 + 50, hit: false });
}
}
spawnFartcoins(level + 2);
document.addEventListener('keydown', e => {
if (e.key === 'ArrowLeft') bean.x -= 20;
if (e.key === 'ArrowRight') bean.x += 20;
if (e.key === ' ') {
rockets.push({ x: bean.x + 20, y: bean.y });
// Optional: new Audio('fart.mp3').play();
}
});
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Bean
ctx.fillStyle = "#964B00";
ctx.fillRect(bean.x, bean.y, bean.width, bean.height);
// Rockets
ctx.fillStyle = "#ff0000";
rockets.forEach(r => {
ctx.fillRect(r.x, r.y, 5, 15);
r.y -= 8;
});
// FARTCOINs
fartcoins.forEach(f => {
if (!f.hit) ctx.drawImage(fartImg, f.x, f.y, 60, 60);
});
// Check collisions
rockets.forEach(r => {
fartcoins.forEach(f => {
if (!f.hit && r.x < f.x + 60 && r.x + 5 > f.x &&
r.y < f.y + 60 && r.y + 15 > f.y) {
f.y += 40;
f.hit = true;
score += 10;
// Optional: new Audio('explosion.mp3').play();
}
});
});
// Filter out cleared FARTCOINs
fartcoins = fartcoins.filter(f => f.y < canvas.height - 60);
// Level up
if (fartcoins.length === 0) {
level++;
spawnFartcoins(level + 2);
}
// HUD
ctx.fillStyle = "#fff";
ctx.font = "20px Comic Sans MS";
ctx.fillText(`Score: ${score}`, 20, 30);
ctx.fillText(`Level: ${level} (${levels[Math.min(level-1,2)]})`, 20, 60);
}
setInterval(draw, 1000 / 60);
๐ฉ How You Can Sweeten the Experience
- ๐ Add humorous sound effects for rocket hits and fart releases
- ๐ฏ Make FARTCOINs slowly drift around the screen like gaseous blobs
- ๐น๏ธ Add touchscreen buttons for mobile play
- ๐งธ Style Little Bean with symbolic layers (coffee aura? crane thread cape?)