Build Angry Birds Game in Python – FuzzuTech GUI Magic!
Demo :
Click Video πππ
πΉ Features (write in blog content):
-
Drag and Shoot using Mouse Events
-
Real Physics with gravity simulation
-
Collision Detection
-
Score Tracking & Game Reset
-
Offline GUI using
tkinter
andPillow
-
Easy to customize – Replace images or add levels!
π Viral YouTube Description
π― Angry Birds in Python? Yup, it's real!
This GUI mini-game was built in Python using tkinter + PIL — just drag the bird, aim, and release! Watch it fly with real gravity physics and collide with the pig to score. Fun project, smooth animation, and totally offline.
π» Tech Stack: tkinter, PIL (Pillow), math
π‘ Highlights:
- Fully offline GUI
- Drag & shoot mechanics
- Animated projectile motion
- Score tracking + reset
π§ Inspired by coding + creativity.
π No external APIs used.
π₯ Perfect for coding reels, tech fun & GUI lovers.
π Subscribe for more Python GUI illusions!
#FuzzuTech #AngryBirdsPython #tkinterGUI #PythonFun #PythonShorts #GameDevPython
Code :
Download This Assets
assets/background.jpg
assets/bird.png
assets/pig.png
import tkinter as tk
from PIL import Image, ImageTk
import math
root = tk.Tk()
root.title("Angry Birds - Fuzzu Edition")
root.geometry("800x450")
root.resizable(False, False)
canvas = tk.Canvas(root, width=800, height=450)
canvas.pack()
# Load images
bg_img = ImageTk.PhotoImage(Image.open("assets/background.jpg").resize((800, 450)))
bird_img = ImageTk.PhotoImage(Image.open("assets/bird.png").resize((50, 50)))
pig_img = ImageTk.PhotoImage(Image.open("assets/pig.png").resize((50, 50)))
# Draw background
canvas.create_image(0, 0, anchor="nw", image=bg_img)
# Variables
bird_x, bird_y = 100, 300
bird = canvas.create_image(bird_x, bird_y, anchor="nw", image=bird_img)
pig = canvas.create_image(650, 300, anchor="nw", image=pig_img)
drag_start = None
dx = dy = 0
gravity = 0.8
flying = False
dots = []
score = 0
high_score = 0
score_text = canvas.create_text(10, 10, anchor="nw", font=("Arial", 16), fill="white", text=f"Score: 0 | High Score: 0")
def reset_game():
global bird_x, bird_y, dx, dy, flying, drag_start, dots
bird_x, bird_y = 100, 300
dx = dy = 0
flying = False
drag_start = None
canvas.coords(bird, bird_x, bird_y)
canvas.delete("result")
for dot in dots:
canvas.delete(dot)
dots.clear()
def update_score():
global score, high_score
canvas.itemconfigure(score_text, text=f"Score: {score} | High Score: {max(high_score, score)}")
def on_mouse_press(event):
global drag_start
if not flying:
drag_start = (event.x, event.y)
def draw_trajectory(start_x, start_y, vx, vy):
global dots
for dot in dots:
canvas.delete(dot)
dots = []
for i in range(1, 15):
t = i * 2
x = start_x + vx * t
y = start_y + vy * t + 0.5 * gravity * (t ** 2)
dot = canvas.create_oval(x, y, x + 3, y + 3, fill="white", outline="")
dots.append(dot)
def on_mouse_drag(event):
if drag_start:
drag_end = (event.x, event.y)
temp_dx = (drag_start[0] - drag_end[0]) / 5
temp_dy = (drag_start[1] - drag_end[1]) / 5
draw_trajectory(bird_x, bird_y, temp_dx, temp_dy)
def on_mouse_release(event):
global dx, dy, flying, drag_start
if drag_start:
drag_end = (event.x, event.y)
dx = (drag_start[0] - drag_end[0]) / 5
dy = (drag_start[1] - drag_end[1]) / 5
flying = True
for dot in dots:
canvas.delete(dot)
dots.clear()
animate_bird()
def animate_bird():
global bird_x, bird_y, dx, dy, flying, score, high_score
if flying:
dx *= 0.99
dy += gravity
bird_x += dx
bird_y += dy
canvas.coords(bird, bird_x, bird_y)
# Collision
pig_coords = canvas.coords(pig)
if abs(bird_x - pig_coords[0]) < 40 and abs(bird_y - pig_coords[1]) < 40:
flying = False
score += 1
if score > high_score:
high_score = score
update_score()
canvas.create_text(400, 200, text="π Hit!", font=("Arial", 36), fill="white", tags="result")
root.after(1500, reset_game)
return
# Miss
if bird_x > 800 or bird_y > 450:
flying = False
score = 0 # reset score on miss
update_score()
canvas.create_text(400, 200, text="❌ Missed!", font=("Arial", 36), fill="red", tags="result")
root.after(1500, reset_game)
return
root.after(20, animate_bird)
# Bind events
canvas.bind("<ButtonPress-1>", on_mouse_press)
canvas.bind("<B1-Motion>", on_mouse_drag)
canvas.bind("<ButtonRelease-1>", on_mouse_release)
update_score()
root.mainloop()
Comments
Post a Comment