I accidentally switched pipe.png with bird.png, it was amazing XD
@arnewaumans50244 жыл бұрын
when I saw this comment, I knew I had to try it
@ibuucoksiregar90244 жыл бұрын
Flappy pipe
@selimustel5775 жыл бұрын
You are doing very well with this tutorial series, also i would like to see the full projects livestream 6 7 or more hours :) i think your channel is going to get bigger exponentially if you keep doing. Thanks man!
@Marc_B.45 жыл бұрын
For those who have "TypeError: integer argument expected, got float" error in collide, just do: top_offset = (self.x - bird.x, int(self.top - round(bird.y))) bottom_offset = (self.x - bird.x, int(self.bottom - round(bird.y)))
@namigaliyev58945 жыл бұрын
int(round(bird.y))
@ibuucoksiregar90244 жыл бұрын
its weird that round() leaves float behind
@chuhokyinhkbuas23374 жыл бұрын
one quick tip. ALWAYS BLIT THE BACKGROUND FIRST IN YOUR redraw window function or else every objects will be covered by your background.
@Danielagostinho215 жыл бұрын
Every video i'm getting more anxious for the next video
@tristansun32745 жыл бұрын
gotta love this series
@gabriellima62482 жыл бұрын
My window is too big to see on the computer screen and because of that i can't see the base image, it's not that its' not there if i check all my windows open by doing a 3 finger swipe up on a mac i can see it, but i can't see it when it have it "maximized" because the 800 pixel height seems to be too big to fit on my screen vertically, does anyone have suggestions?
@Andrei-zh5jv5 жыл бұрын
Thanks for the upload frequency
@Soljarag55 жыл бұрын
Thanks!!!!!!! So far I have gotten this to work.... on to the next video tomorrow.
@infinitespace19822 жыл бұрын
7:49 At this point, I try to run my code, it works fine but when the bird is halfway through passing the first pipe, the game freezes and then crashes for some reason. Can anyone please help me?
@shuvadass75254 жыл бұрын
Can I use NEAT in Reinforcement Learning? Especially to a simple monte Carlo prediction/ control problem where an agent can be the genome and its policy can be gene. Do I have to build an equivalent Neural Network with MC logic first in order to apply NEAT or does it not matter, any simple NN would do without the MC logic?
@tombil-certon5 жыл бұрын
Amazing video Tim :D
@pranjal11004 жыл бұрын
My first pipe renders fine, rest of the pipe sort stack up one another, how do i adjust the distance bw two pices? Note: Distance b/w first and second pipe is fine and can adjusted by the "pipes.append(Pipes(distance))"
@kevinliu50604 жыл бұрын
I know its kinda late, but I had the same problem. I did a little editing in the code and somehow got it to work. Remove = [] add_pipe = False for pipe in pipes: pipe.move() if pipe.collide(bird): pass if pipe.x + pipe.Pipe_Top.get_width() < 0: Remove.append(pipe) if not pipe.passed and pipe.x < bird.x: pipe.passed = True add_pipe = True if add_pipe: score += 1 pipes.append(Pipe(Display_Width)) for r in Remove: pipes.remove(r) draw_window(win, bird, pipes, base) Hope it helps!
@sashamuller97434 жыл бұрын
@@kevinliu5060 for future people with the same problem. you must add pipe.passed = True as shown in the code above by Kevin Liu and Tim's code
@tigernav33504 жыл бұрын
@@kevinliu5060 holy shit thanks
@techtutorials88124 жыл бұрын
"That's what I've figured out is kinda like the best position". Isn't it better to figure out what, say two-fifths of the way from the left is, and use that, rather than hard-coding in the values? Same with the base, better to use the height of the window minus the height of the image.
@aiden40535 жыл бұрын
Great video! Can't wait for the next one, keep it up!
@vp90415 жыл бұрын
Waiting for the next one
@samwillis18564 жыл бұрын
Hi, been watching this series for the last day and going through it. Was just wondering if you had any videos on how to implement it so it's just playable as a game and nothing to do with ai. just wanted to create this so me and my friends can play it! thanks!
@user-hd6xc1xn9d4 жыл бұрын
Make the jump function activated by a click or a spacebar press
@sashamuller97434 жыл бұрын
he has a great video on space invaders, that show how to implement key inputs from the user and get the player to move around. also check the last video in this series where he implements the keystrokes to be done by the A.I, in order to reference how the jump() and move() methods are used to get the bird to jump
@jonathanfisher66443 жыл бұрын
im sure this is super janky but put this in the for event in pygame.get(): loop if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: bird.jump()
@cjclines36115 жыл бұрын
Hi Tim, i have an issue with this bit; def main(): bird = Bird(230, 350) base = Base(730) pipes = [Pipe(700)] win = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT)) clock = pygame.time.Clock() you are at the part where you are starting to code the base moving, but ive ran the code and i have pipes already showing and the base is glued to the top of the window? im very confused, any help would be greatly recieved.
@cjclines36115 жыл бұрын
Edit: dont worry all sorted stupid me messed up with the initial self.y = y bit
@23kaz514 жыл бұрын
Hey, if we do not make "add_pipe" false again, then there will be mess with pipes. I wrote exactly what you wrote, and mess appeared. After I made "add_pipe" false again after "pipes.append(Pipe(600))", then everything worked well. The main question is WHY?
@23kaz514 жыл бұрын
Stupid question. I didn't notice that you created "add_pipe" in the while-loop
@JoaoGuilherme-ez8xm3 жыл бұрын
bro thank you so much for this, I was having this same issue!!
@jasarosker7726 Жыл бұрын
Does any1 have same problem as me? When I run the code, opens normal etc... but it's like zoomed in. I only see top half of the game.
@jamminwithyou2 Жыл бұрын
I have the same issue and the pipe that's on the floor is stuck to the top of the screen.
@harryleib43034 жыл бұрын
i cant adjust the image sizes to my scren... could someone help me please? the imgaes seems too big and i cant see the base img
@iamo4 жыл бұрын
use the following code to fit image to size of your window: BG_IMG = pygame.transform.scale(pygame.image.load(os.path.join("imgs", "bg.png")), (WIN_WIDTH, WIN_HEIGHT))
@electronics_87224 жыл бұрын
Very nice tutorials! everything works perfect!
@chekystar4 жыл бұрын
best tutorial ever: even better with 0.5 play speed you sound sooo stoned :P i hope that you are not using tenserflow for ai cause it doesnt work on my "calculator" :)
@novicephiladelphia.d47885 жыл бұрын
Great ! Hope there will have some videos about optimizing the code :p
@anshulraj12374 жыл бұрын
Was following the tutorial and when I did ctrl b to run I got this AttributeError: 'Pipe' object has no attribute 'set_height' what should I do?
@AgentRex425 жыл бұрын
When I try to run it doesn't work. I have "TypeError: draw() missing 1 required positional argument: 'win' "...
@NotxarbProd5 жыл бұрын
ME TOO I AM ABOUT TO KILL PC
@anawilliams13323 жыл бұрын
same
@harshdeeptelang1273 жыл бұрын
@@NotxarbProd lmaao
@penneshells54484 жыл бұрын
I have coded up to 8.06 and the first pipe appears bit not a second pipe. No error message or anything. Any reason this might happen would be great, thanks!
@penneshells54484 жыл бұрын
Never mind, no clue what I did, but it seems okay now.
@aniketbhattacharjee11233 жыл бұрын
hey bro, I dont know why but the my pipe seems to render behind the bird and stays there only. any help?
@lees8522 жыл бұрын
I am having trouble with get_mask() it keep saying arguument 1 must be pygame.surface not list.
@jhonalkas55604 жыл бұрын
HELP! Everything is fine when I run the script but the second I get to my first pipe it crashes, does anyone know a fix?
@ibuucoksiregar90244 жыл бұрын
make sure you typed: for r in rem: pipes.remove(r) i typed pipes.append instead of pipes.remove
@smurfgreen57414 жыл бұрын
I'm a bit late... but if it isnt what the comment above says, then it is most likely you did not make score = 0 underneath "clock = pygame.time.Clock" should be around line 177ish Hope this helps : )
@leoliu61434 жыл бұрын
Jhon Alkas I think the problem is that you have to write the remove and add pipe statement outside the for loop, hope helped:)
@degstenk4 жыл бұрын
@@ibuucoksiregar9024 helped
@8pczzz2 жыл бұрын
@@leoliu6143 kuddos to you sir, was going crazy over here trying to figure it out
@huytruongle5194 жыл бұрын
TypeError: draw() takes 1 positional argument but 2 were given help pls
@toastybread70854 жыл бұрын
make sure everywhere draw() is written you have the same items inside
@jagadishb144 жыл бұрын
Hey Tim I was also coding this, I thought why not ai plays Mario forever can you make one this game please. Many people like Mario too
@vyddikkk5 жыл бұрын
help pleas self.set_height() AttributeError: 'Pipe' object has no attribute 'set_height'
@huytruongle5194 жыл бұрын
@Coding Call i checked all of them and cannot find a spelling mistake
@huytruongle5194 жыл бұрын
oh i accidentally indented them all nvm
@ScriptLineStudios4 жыл бұрын
For some reason my bird freezes when it passes the first pipe
@smurfgreen57414 жыл бұрын
I'm a bit late... but for anyone else that may be struggling in the future and to stop you from having a breakdown like i did: score = 0 underneath "clock = pygame.time.Clock" should be around line 177ish timestamp is 5.56 Hope this helps : )
@leoliu61434 жыл бұрын
I think the problem is that you have to write the remove and add pipe statement outside the for loop, hope helped:)
@tthelix4 жыл бұрын
@@smurfgreen5741 You the real MVP
@hrishikeshghongane50274 жыл бұрын
My pipes are not visible, not able to figure the issue.
@sagittario87962 жыл бұрын
bird object has no attribute 'mask' how do i fix this ?
@joshuawheeler32554 жыл бұрын
I have everything working correctly, but the game is running extremely slowly. It is almost less than a frame a second. It has been doing so since the very beginning when I put just the bird on the screen and had it flap its wings. I have a decently new gaming laptop, so hardware should not be the problem. My cpu/gpu usage is tiny, and I have plenty of ram. Do you have any idea what is wrong? I restarted computed and disabled windows defender, but neither option helped. These videos are great BTW, thanks.
@TechWithTim4 жыл бұрын
Make sure you don’t have too low of a delay or that your clock speed isn’t too low.
@joshuawheeler32554 жыл бұрын
@@TechWithTim I'm sorry I'm not sure what you mean. What delay? And are you talking about the stock clock speed of my CPU or something else?
@matthewbrown47824 жыл бұрын
Joshua Wheeler If you right click on the app that opens in your dock when you run Pygame, click options, open in finder, right click python, click get info, and under general check “open in low resolution”
@betterer5 жыл бұрын
Great vid
@sashamuller97434 жыл бұрын
i'm not really sure what pipe.passed is, could anyone help?
@jbg08014 жыл бұрын
anyone know how to fix the error: bad operand type for unary +: 'str' when referring to the line text = STAT_FONT.render("Score: ", + str(score), 1, (255, 255, 255))
@AirFling4 жыл бұрын
This may be a bit late. but remove the comma after "Score: "
@adityasoma12944 жыл бұрын
what code should we input if we want to control the bird manually. pls advise.
@kristianlynes59084 жыл бұрын
i also want to know this, commenting for if someone comes with an answer
@ZenithYap3 жыл бұрын
what does self.passed do?
@aryanbhatia69925 жыл бұрын
Amazing Video.
@ayhanardal Жыл бұрын
I get the error " 'Pipe' object is not iterable" when i run for loop with pipes
@jamminwithyou2 Жыл бұрын
Had the same problem. Make sure pipes = [Pipe(700)] in the coding.
@exelbernardi64935 жыл бұрын
Amazing video,
@ballistics88184 жыл бұрын
"base has no attribute move" did i miss something?!?
@anshulraj12374 жыл бұрын
What did you do to solve this similar problem with pipe
@MA-hk3qg3 жыл бұрын
def draw_window(win, bird, pipes, base, *score*) ... *score* += 1 ... draw_window(win, bird, pipes, base, *score*) I keep getting the error message: line 221, (the score += line), in main draw_window(win, bird, pipes, base, score) UnboundLocalError: local variable 'score' referenced before assignment
@MA-hk3qg3 жыл бұрын
Help!
@ibuddywolfie78825 жыл бұрын
Someone PLEASE help me, I have been working on fixing this error for an hour and a half minimum, and I even rewritten my code following this video 4 times. I get the following error: AttributeError: Bird instance has no attribute 'img' when I try and do "if pipe.collide(bird):" Please someone help me! Edit: I just want to put this out here, I modified no code at all when rewriting to see if it was my modifications or not, but when I rewrote this code exactly letter by letter from the video, I still get the same error! If any more details is needed for someone to help me, please let me know! I need help :c Edit 2: This error also causes lots of other errors in my code, the one on the very top is on line 82, where the get_mask is. The error is on the return line. Another error is on line 114 for the collide, the code for that line is "bird_mask = bird.get_mask()". I don't know if these are what caused AttributeError but yeah, can someone please help me?
@charlestilden12685 жыл бұрын
Have you checked the capitalization of the variables? I noticed that was an issue when doing this tutorial.
@indrektalving44255 жыл бұрын
Make sure you have "self.img = self.IMGS[0]" in your Bird __init__. By following everything line by line I had it wrong for some reason
@NurglesToes4 жыл бұрын
@@indrektalving4425 thanks for this. also had quite a few problems with going line by line lol.
@playnolife4 жыл бұрын
keep getting: in main base = Base(730) TypeError: Base() takes no arguments can someone help :C
@playnolife4 жыл бұрын
nvm i used _index_ instead of _init_
@adamkerkemeyer4 жыл бұрын
@@playnolife interesting coincidence we had the same spelling mistake
@kevinliu50604 жыл бұрын
Wow thanks Lol I had "int" instead of "init" and it took for forever to realize until I saw this comment
@likithas12864 жыл бұрын
****** Running generation 0 ****** C:/Users/TANMAY/PycharmProjects/helloworld/NEAT-Flappy-Bird-master/flappy_bird.py:252: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. new_rect = rotated_image.get_rect(center=image.get_rect(topleft=topleft).center) Please help me with this error!
@NotxarbProd5 жыл бұрын
PLEASE PLEASE PLEASE HELP ME THE HEIGHT OF THE WINDOW IS TOO BIG FOR MY SCREEN SO I CANT SEE THE GROUND OR BASE
@sainco30365 жыл бұрын
thanks.
@AgentRex425 жыл бұрын
Cool !
@totoma32974 жыл бұрын
my score isn't going up anyone have any idea why
@yabbieo84663 жыл бұрын
I know its late.. for some reason my score is behind the background.. Haven't figured out how to fix it yet..
@aunkitchaki99433 жыл бұрын
@@yabbieo8466 hey man I am facing this same issue, any idea how to solve this?
@pravachanpatra40122 жыл бұрын
9:00
@ark54584 жыл бұрын
my own reference dont mind me 4:13
@shridumanish35064 жыл бұрын
My base goes upwards lol
@ibuddywolfie78825 жыл бұрын
Hi so I wrote a help comment last night and its still not fixed, and instead of editing that one and making it another 10000000000 characters longer, I figured I would make a new comment. My get_mask errors, and the code is: def get_mask(self): return pygame.mask.from_surface(self.img) The error is: AttributeError: Bird instance has no attribute 'img' Can someone help? tysm
@NotxarbProd5 жыл бұрын
IBuddyWolfie try changing img to IMG
@alialmeerahmed69944 жыл бұрын
7.30
@VerifyBot5 жыл бұрын
Welp anyone else having this problem?? imgur.com/a/GrTz37D
@Cliper10113 жыл бұрын
Can i directly remove the pipe from pipes instead of append it to remove then removing it. pipes.remove(pipe) like this
@josima4 жыл бұрын
my bird freezes when it gets to the first pipe :(
@smurfgreen57414 жыл бұрын
I'm a bit late... but for anyone else that may be struggling in the future and to stop you from having a breakdown like i did: score = 0 underneath "clock = pygame.time.Clock" should be around line 177ish timestamp is 5.56 Hope this helps : )
@BerryTwoC4 жыл бұрын
It could also be because of indentation, I had that problem as well when my add_pipe condition was within the for loop for pipes.