HOW TO MAKE PONG IN PYTHON AND PYGAME! (15 Min)

  Рет қаралды 6,142

baraltech

baraltech

Күн бұрын

📑 SUMMARY
In this video, I show you how to create Pong in Python and PyGame in 15 minutes! Learn Python and PyGame by making Pong in this video!
🔔 SUBSCRIBE - bit.ly/baraltech
📧 EMAIL for Business - mailto:lartech2007@gmail.com
🔗 LINKS
Pastebin Link: pastebin.com/C16DZd2B
GitHub: github.com/baraltech/Pong
⌚ TIMESTAMPS
0:00​ | Intro
0:21 | PyGame Boilerplate
0:45 | Creating the Paddles
3:15 | Adding Movement
6:44 | Making the Ball
8:57 | Ball Logic
13:41 | Creating the Opponent AI
15:09 | Making a Score System
16:50 | End
🎬 MY SETUP:
💻 PC: Custom Built:
✅ Intel Core i5-10400F
✅ Gigabyte NVIDIA GeForce GTX 1060 3 GB WINDFORCE OC
✅ Gigabyte B560M DS3H AC
✅ G-Skill Ripjaws V DDR4-3200MHz CL16 RAM (2x8 GB)
✅ DeepCool MACUBE 110 Micro-ATX Case
✅ Western Digital Blue SN550 500 GB NVMe SSD
✅ EVGA 500 BR 80+ Bronze Power Supply
⌨️ Keyboard: Razer Huntsman Gaming Keyboard (Razer Opto-Mechanical Purple Switches)
🖥️ Monitor: ASUS VP228 21.5” 1080p 75Hz
🖱️ Mouse: VicTsing 2.4GHz Wireless Mouse
🎙️ Mic: Blue Yeti USB Condenser Microphone
💻 Secondary Laptop/Monitor: Dell Inspiron 11-3185 2-in-1
🏷️ TAGS
- Pong Game
- Pong PyGame
- Make Pong in Python
HASHTAGS:
#PyGame #Pong #Python

Пікірлер: 27
@OrangeDied
@OrangeDied 2 жыл бұрын
impressive explanations and editing, surprised you don't have more subs!
@NoobContent
@NoobContent 6 ай бұрын
It turns out if you create a variable called opponent_speed = (any number you want) and then put it here like this: if opponent.y < ball.y: opponent.top += opponent_speed if opponent.bottom > ball.y: opponent.bottom -= opponent_speed You can set how good the opponent can be!
@NoobContent
@NoobContent 6 ай бұрын
Note: I don't know why the opponent turned into a link
@tjabbar
@tjabbar Жыл бұрын
Thank you, this helped me out a lot
@baraltech
@baraltech Жыл бұрын
Glad I could help!
@krishpurani7809
@krishpurani7809 2 жыл бұрын
Proud of you lil dawg!
@baraltech
@baraltech 2 жыл бұрын
Thank you Krishnaji
@tracy1944
@tracy1944 2 жыл бұрын
i don't even code but this is actually surprisingly engaging and i can tell every second of it has effort put in. nice job :)
@tracy1944
@tracy1944 2 жыл бұрын
nobody asked but actually i did a coding class in elementary
@baraltech
@baraltech 2 жыл бұрын
This made my -day- This made my -week- This made my -month- This made my life
@mohammadsaleem4956
@mohammadsaleem4956 Жыл бұрын
Great Job, Young Programmer!!!
@baraltech
@baraltech Жыл бұрын
Thank you!
@juliansolanobotina7983
@juliansolanobotina7983 4 ай бұрын
hey, i've got a problem, in the minute 10:49 when the ball must come back to the center after a point, i can't use ball.CENTER, it says "Cannot assign member "center" for type "Rect" "float" is incompatible with "int" "float" is incompatible with "int"
@aatmanshah3073
@aatmanshah3073 8 күн бұрын
its supposed to lowercase
@aatmanshah3073
@aatmanshah3073 8 күн бұрын
the center
@hri613
@hri613 Жыл бұрын
what code editor did you use for python in this video? Atom?
@baraltech
@baraltech Жыл бұрын
VS Code!
@andrewsodyssey5753
@andrewsodyssey5753 2 жыл бұрын
Yo this is fantastic but for the score part I get an issue message in pycharm that says "End of statement expected" if you know how to fix that then it would be greatly appreciated
@baraltech
@baraltech 2 жыл бұрын
Thanks for the comment! Could you please send your code so I can take a look at it and fix your error? Thank you!
@andrewsodyssey5753
@andrewsodyssey5753 2 жыл бұрын
@@baraltech import pygame, sys, random pygame.init() WIDTH,HEIGHT = 1200, 720 FONT = pygame.font.SysFont("Consolas",int(WIDTH/20)) SCREEN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Ponk") CLOCK = pygame.time.Clock() player = pygame.Rect(WIDTH-110, HEIGHT/2-50, 10, 100) opponent = pygame.Rect(110, HEIGHT/2-50, 10, 100) player_score, opponent_score = 0,0 ball = pygame.Rect(WIDTH/2-10, HEIGHT/2-10, 20, 20) x_speed, y_speed = 1,1 while True: keys_pressed = pygame.key.get_pressed() if keys_pressed[pygame.K_UP]: if player.top > 0: player.top -= 2 if keys_pressed[pygame.K_DOWN]: if player.bottom < HEIGHT: player.bottom += 2 for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if ball.y >= HEIGHT: y_speed = -1 if ball.y
@andrewsodyssey5753
@andrewsodyssey5753 2 жыл бұрын
@@baraltech it could just be Pycharm being picky but I'm not sure
@baraltech
@baraltech 2 жыл бұрын
@@andrewsodyssey5753 I tried running your exact code and the scoreboard shows up for me.. strange
@andrewsodyssey5753
@andrewsodyssey5753 2 жыл бұрын
@@baraltech Huh, how strange it must just be Pycharm being picky but thanks anyways
@aks_ctrl3798
@aks_ctrl3798 2 жыл бұрын
what app is that
@baraltech
@baraltech 2 жыл бұрын
Python?
@aks_ctrl3798
@aks_ctrl3798 2 жыл бұрын
@@baraltech it doesn't show me the numbers
@baraltech
@baraltech 2 жыл бұрын
@@aks_ctrl3798 You mean the score? That's strange. Can you send your code?
Pygame in 90 Minutes - For Beginners
1:35:22
Tech With Tim
Рет қаралды 1 МЛН
2 Python Developers VS $1000
15:04
PolyMars
Рет қаралды 1,8 МЛН
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 50 МЛН
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 119 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 4,4 МЛН
Pong Game Tutorial using Pygame & Python - For beginners
39:50
Programming With Nick
Рет қаралды 7 М.
Making My Own Programming Language and Coding a Game in It
10:19
AstroSam
Рет қаралды 1,2 МЛН
Make Pong With Python!
1:12:42
Tech With Tim
Рет қаралды 113 М.
Python Game Tutorial: Pong
44:03
freeCodeCamp.org
Рет қаралды 510 М.
Уроки Python / Как сделать игру Змейка (Мастер-класс)
50:22
Изучаем мир ИТ / Олег Шпагин / Программирование
Рет қаралды 58 М.
AI Learns What Pizza Is
8:03
Green Code
Рет қаралды 343 М.
5 Tips To Write Better Python Functions
15:59
Indently
Рет қаралды 97 М.
Learning pygame by creating Snake [python tutorial]
2:05:00
Clear Code
Рет қаралды 346 М.
If You Can't Make Games After This Video, Give Up
4:37
Fredyy
Рет қаралды 813 М.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 664 М.
iPhone socket cleaning #Fixit
0:30
Tamar DB (mt)
Рет қаралды 12 МЛН
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 6 МЛН
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 1,8 МЛН
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 79 М.
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 2,2 МЛН