Discover amazing projects created by our talented students. Like, love, and star your favorites!
Alexander Julian
3 weeks ago
Watch out for the throne! your task is to protect the trophy from falling to an endless loop. Make sure that the trophy are in contact with the surface.
GRACIA ALLELUIA RAHAYU
3 weeks ago
How to play: Press space to make the owl jump. Don't hit the pipe. And that's it. Hope you enjoy.
Scratch
Jonathan Clifford Prayogo
3 weeks ago
gerakkan bus dengan tekan tombol panah atas bawah kiri dan 0
William Tedjosaputro
3 weeks ago
Wah, mantap! đ Jadi konsep gamenya: đšī¸ Judul: Flapy Jump đ¯ Tujuan: Jangan kena pipa, kalau kenaimport pygame, sys, random pygame.init() lebar, tinggi = 400, 600 layar = pygame.display.set_mode((lebar, tinggi)) clock = pygame.time.Clock() font = pygame.font.SysFont(None, 48) # Warna biru = (135, 206, 235) hijau = (0, 200, 0) kuning = (255, 255, 0) # Karakter burung = pygame.Rect(100, tinggi//2, 34, 24) gravitasi = 0 pipa_list = [] score = 0 def buat_pipa(): tinggi_pipa = random.randint(150, 450) bawah = pygame.Rect(lebar, tinggi_pipa, 52, tinggi - tinggi_pipa) atas = pygame.Rect(lebar, tinggi_pipa - 150 - 320, 52, 320) return atas, bawah def gerak_pipa(pipa_list): for pipa in pipa_list: pipa.centerx -= 3 return [p for p in pipa_list if p.right > 0] def tampil_score(): teks = font.render(str(score), True, (0, 0, 0)) layar.blit(teks, (lebar//2 - teks.get_width()//2, 50)) pipa_timer = pygame.USEREVENT + 1 pygame.time.set_timer(pipa_timer, 1400) # Loop utama jalan = True while jalan: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: gravitasi = -7 if event.type == pipa_timer: pipa_list.extend(buat_pipa()) # Fisika burung gravitasi += 0.4 burung.y += gravitasi # Gerak pipa pipa_list = gerak_pipa(pipa_list) # Deteksi tabrakan for p in pipa_list: if burung.colliderect(p): pygame.quit() sys.exit() if burung.top <= 0 or burung.bottom >= tinggi: pygame.quit() sys.exit() # Skor for p in pipa_list: if p.centerx == burung.centerx: score += 1 # Gambar layar.fill(biru) pygame.draw.rect(layar, kuning, burung) for p in pipa_list: pygame.draw.rect(layar, hijau, p) tampil_score() pygame.display.update() clock.tick(60) kalahpygame.init() lebar, tinggi = 400, 600 layar = pygame.display.set_mode((lebar, tinggi)) clock = pygame.time.Clock() font = pygame.font.SysFont(None, 48) biru = (135, 206, 235) hijau = (0, 200, 0) kuning = (255, 255, 0) burung = pygame.Rect(100, tinggi//2, 34, 24) gravitasi = 0 pipa_list = [] score = 0 # ====== HIGH SCORE SYSTEM ====== HIGH_SCORE_FILE = "highscore.txt" def load_high_score(): if os.path.exists(HIGH_SCORE_FILE): with open(HIGH_SCORE_FILE, "r") as f: try: return int(f.read()) except: return 0 return 0 def save_high_score(skor): with open(HIGH_SCORE_FILE, "w") as f: f.write(str(skor)) high_score = load_high_score() # ====== GAME FUNCTIONS ====== def buat_pipa(): tinggi_pipa = random.randint(150, 450) bawah = pygame.Rect(lebar, tinggi_pipa, 52, tinggi - tinggi_pipa) atas = pygame.Rect(lebar, tinggi_pipa - 150 - 320, 52, 320) return atas, bawah def gerak_pipa(pipa_list): for pipa in pipa_list: pipa.centerx -= 3 return [p for p in pipa_list if p.right > 0] def tampil_score(): teks = font.render(f"{score}", True, (0, 0, 0)) layar.blit(teks, (lebar//2 - teks.get_width()//2, 50)) hs_teks = pygame.font.SysFont(None, 28).render(f"High Score: {high_score}", True, (0, 0, 0)) layar.blit(hs_teks, (10, 10)) # ====== GAME LOOP ====== pipa_timer = pygame.USEREVENT + 1 pygame.time.set_timer(pipa_timer, 1400) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: gravitasi = -7 if event.type == pipa_timer: pipa_list.extend(buat_pipa()) gravitasi += 0.4 burung.y += gravitasi pipa_list = gerak_pipa(pipa_list) for p in pipa_list: if burung.colliderect(p): if score > high_score: save_high_score(score) pygame.quit() sys.exit() if burung.top <= 0 or burung.bottom >= tinggi: if score > high_score: save_high_score(score) pygame.quit() sys.exit() # Tambah skor for p in pipa_list: if p.centerx == burung.centerx: score += 1 layar.fill(biru) pygame.draw.rect(layar, kuning, burung) for p in pipa_list: pygame.draw.rect(layar, hijau, p) tampil_score() pygame.display.update() clock.tick(60) đ Catatan: Skor tertinggi disimpan di file highscore.txt, jadi tidak hilang meskipun kamu keluar dari game. đ Versi HTML + JavaScript â dengan High Score Simpan sebagai flapy_jump.html <!DOCTYPE html> <html lang="id"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Flapy Jump</title> <style> body { margin: 0; overflow: hidden; background: skyblue; } canvas { display: block; margin: auto; background: #87ceeb; } </style> </head> <body> <canvas id="game" width="400" height="600"></canvas> <script> const canvas = document.getElementById('game'); const ctx = canvas.getContext('2d'); let birdY = 300, velocity = 0, gravity = 0.4; let pipes = []; let score = 0, highScore = localStorage.getItem('highScore') || 0; let frame = 0; function jump() { velocity = -7; } document.addEventListener('keydown', e => { if (e.code === 'Space') jump(); }); function reset() { if (score > highScore) { highScore = score; localStorage.setItem('highScore', highScore); } birdY = 300; velocity = 0; pipes = []; score = 0; frame = 0; } function draw() { ctx.fillStyle = '#87ceeb'; ctx.fillRect(0, 0, 400, 600); // Burung ctx.fillStyle = 'yellow'; ctx.fillRect(100, birdY, 30, 24); // Pipa if (frame % 90 === 0) { const topHeight = Math.random() * 200 + 100; pipes.push({x: 400, top: topHeight, bottom: topHeight + 150}); } for (let p of pipes) { p.x -= 3; ctx.fillStyle = 'green'; ctx.fillRect(p.x, 0, 50, p.top); ctx.fillRect(p.x, p.bottom, 50, 600 - p.bottom); if (100 + 30 > p.x && 100 < p.x + 50 && (birdY < p.top || birdY + 24 > p.bottom)) { alert('đĨ Kena pipa!\nSkor kamu: ' + score + '\nHigh Score: ' + highScore); reset(); return; } } pipes = pipes.filter(p => p.x + 50 > 0); velocity += gravity; birdY += velocity; if (birdY < 0 || birdY > 600) { alert('đĨ Kamu jatuh!\nSkor kamu: ' + score + '\nHigh Score: ' + highScore); reset(); return; } if (frame % 90 === 0) score++; ctx.fillStyle = 'black'; ctx.font = '36px Arial'; ctx.fillText(score, 190, 50); ctx.font = '20px Arial'; ctx.fillText("High Score: " + highScore, 10, 30); frame++; requestAnimationFrame(draw); } draw(); </script> </body> </html> đ Misi: Kalahkan high score kalian! đ Kontrol: Tekan spasi buat lompat
Danadyaksa Reynald Adhyastha
3 weeks ago
press space to jump and you have to get 20 lives to win