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"
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!
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
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 :)
nobody asked but actually i did a coding class in elementary
This made my -day-
This made my -week-
This made my -month-
This made my life
Great Job, Young Programmer!!!
Thank you!
Proud of you lil dawg!
Thank you Krishnaji
u need more subs this is actually so good.
impressive explanations and editing, surprised you don't have more subs!
Thank you, this helped me out a lot
Glad I could help!
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"
its supposed to lowercase
the center
I need help. When I finish creating the paddles, the game screen shows nothing but a black screen. Is there anyway to fix it?
btw if you want the ai a bit faster just chance the value to 2 it moves faster :)
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!
Note: I don't know why the opponent turned into a link
what code editor did you use for python in this video? Atom?
VS Code!
whenever i run it opens a widow with a green backround ad loads of lillte balls
thank you
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
Thanks for the comment! Could you please send your code so I can take a look at it and fix your error? Thank you!
@@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
@@baraltech it could just be Pycharm being picky but I'm not sure
@@andrewsodyssey5753 I tried running your exact code and the scoreboard shows up for me.. strange
@@baraltech Huh, how strange it must just be Pycharm being picky but thanks anyways
what app is that
Python?
@@baraltech it doesn't show me the numbers
@@aks_ctrl3798 You mean the score? That's strange. Can you send your code?
visual studio code
I think he meant the code shown in the video like the scripts not the software you used