Pygame Tutorial for Beginners - Python Game Development Course

Поділитися
Вставка
  • Опубліковано 2 жов 2024

КОМЕНТАРІ • 3,2 тис.

  • @rakstar343
    @rakstar343 4 роки тому +1986

    bruh listening to indian dudes on youtube is wayyyyy better than school

    • @Dante-nu5cn
      @Dante-nu5cn 4 роки тому +50

      Lol I was just thinking the same

    • @its_layth2530
      @its_layth2530 3 роки тому +20

      no it is not
      .

    • @binku09
      @binku09 3 роки тому +39

      @@its_layth2530 you might be enjoying something else. Why tell everybody??

    • @Anu-hv2pp
      @Anu-hv2pp 3 роки тому +16

      Right?! I was assigned to make a game using pygame but my teachers such a horrible teacher that no one understood anything 😃-

    • @TheRealOderless635gnat
      @TheRealOderless635gnat 3 роки тому +3

      @saketh p
      #ThioJoke

  • @Pontiflex
    @Pontiflex 3 роки тому +276

    the video: bullet_state = "Fire"
    boolean: "Am I a joke to you?"

    • @zasbirrahmanzayan8648
      @zasbirrahmanzayan8648 3 роки тому +3

      ikr

    • @hossumquat
      @hossumquat 3 роки тому +7

      Some things in this just don't make sense. Like the spaceship seems to be shooting from it's left and right cannons, but really you shoot a huge bullet from the nose of your ship. But hey, that's not the point, right? You should be focused on the education!

    • @alphasoundz9850
      @alphasoundz9850 3 роки тому +1

      Truuueee haha😂

    • @4glassmilk635
      @4glassmilk635 3 роки тому +9

      Boolean is fired
      Sorry

    • @akhandpathi7461
      @akhandpathi7461 3 роки тому +1

      @@4glassmilk635 😂😂😂

  • @djlazer1
    @djlazer1 3 роки тому +213

    It's funny how he explains that adding negative numbers is subtracting but also assumes we know the distance between two points algebraic equation

    • @troyna77
      @troyna77 3 роки тому +1

      If you've installed python (by yourself)you definitely know the distance between two points formulas in all it's forms. It's math. If you think this is hard, Wait until you need to apply trig functions.

    • @TheRealLyonic
      @TheRealLyonic 3 роки тому +48

      @@troyna77 I'm afraid this is actually objectively false. The principals of Algebra-However basic in this example- have absolutely nothing to do with the ability to use a computer to connect to the internet and then click the download button on the Python public website. Furthermore, on your-poorly hidden- implication that you can't be a real programmer without the backhand knowledge of both Algebra and-at least fundamental- Trigonometry, there are plenty of programmers who have created respectable and renowned programs without the use of any Algebraic Formulas for calculating distance or any Trigonometry. And though I understand it's probably a bit hard for you to understand, these people are just as much of a programmer as you and me. This comment isn't a good-willed attempt to clarify the mindset of the instructor, it's a short-sighted jab at someone who just wanted to make a joke. And quite frankly, the fact that there are people like this outwardly representing this art in this way appalls me.

    • @devarora7041
      @devarora7041 3 роки тому +8

      @@TheRealLyonic wowza

    • @GameDevNerd
      @GameDevNerd 3 роки тому +1

      @@TheRealLyonic well said ... trigonometry also isn't objectively "difficult" to use in programming, you're just calling a function and letting it do all the calculations for you. The only important thing is to know why and when you need to call a particular function and what part of the result matters to you. Someone who needs to know can learn it by reading some simple rules about trigonometry and what the terminology means. But in no way is trigonometry connected to how good of a programmer someone is, unless they work in a very specific field where it's critically important. I'm DirectX/C++ programming and Unity/C# development (which is considerably more complex) I only used trigonometry in a few isolated cases where I found some novel use for the properties of triangles, like determining how high off a ground an object will be if it's rotated about an axis X-distance away from by so many radians. That guy's comment reads like someone with no dev experience trying to sound like an elitist expert by tossing around some things that sound intimidating and pretending to understand them lol.

    • @TheRealLyonic
      @TheRealLyonic 3 роки тому +1

      @@GameDevNerd I agree completely! And appreciate the well-thought out reply. Also, I respect the DirectX/C++ programming stuff, I focus more on Java and the Web Development tools (HTML, CSS, and Javascript), and always found that stuff to be a bit complicated for my understanding. Though, I will say, I actually worked in Unity with C# for a while too a good bit ago, which was relatively easy to migrate into language wise, since Java and C# are almost the exact same language in terms of Syntax. Though it did take a while for me to learn the ins and outs of Unity as a game engine, working with Rigidbodies and all the other various elements in a game. All that being said, love the input, and thanks for the reply ❤️

  • @traumaterasu
    @traumaterasu 3 роки тому +779

    First guy who has made a proper tutorial glad to see that people like them exist in this world

  • @davidmargis3476
    @davidmargis3476 3 роки тому +183

    This has to be the most useful learn-by-doing Pygame tutorial I've seen. You start with the basics, explain what you want to do and how Pygame allows you to do it, and work it in with concepts a learning programmer should be aware of, without jumping right into the more complex aspects.

  • @WatOnsonn
    @WatOnsonn 3 роки тому +643

    1:35:00
    For collision detection pygame actually has a method called 'colliderect' which detects collision between rectangles. So, if you want to check if the enemy rectangle has collided with the bullet rectangle, instead of checking the distance between the two for every frame, you just write:
    if enemy_rectangle.colliderect(bullet_rectangle)
    [whatever you want to do when the enemy collides with a bullet, or vice versa]
    Hope this helps

    • @chimimiiiii
      @chimimiiiii 3 роки тому +3

      thanks for the tip

    • @hossumquat
      @hossumquat 3 роки тому +6

      Is it simple rectangle overlap? Or does it then further check for pixel overlap (if there is transparency in either image)?

    • @kasperpettersson1804
      @kasperpettersson1804 3 роки тому +6

      @@hossumquat im trying to figure out the same, gotten any results? Also how do you call the enemy rectangle if the enemy is an image?

    • @bigshrek2324
      @bigshrek2324 3 роки тому +1

      helped soo much thanks

    • @adlerdoesstuff1872
      @adlerdoesstuff1872 3 роки тому +13

      why are you even here your an expert

  • @pinkdolphin8017
    @pinkdolphin8017 4 роки тому +180

    Only this man can make a spaceship question their existence

  • @seaburyacademy
    @seaburyacademy 3 роки тому +75

    I imagine you might not be monitoring the comments anymore by now, but I'm finding this really helpful! I have to try to help some students pick up some programming skills, and this tutorial is great! The detail that you go into about why things have to be the way they are is very helpful. Thanks!

  • @somshridhar
    @somshridhar 5 днів тому

    Wow Finally I successfully completed coding , implemented and played the game. Thanks a lot

  • @sakifhossain5424
    @sakifhossain5424 4 роки тому +11

    In my few months of learning coding
    this video has brought a lot of positive vibe to me as
    i finally got the feeling of creating something solid real
    thank you

  • @jwebbs999
    @jwebbs999 4 роки тому +10

    Appreciated how digestible you made everything. Tough material to do that with 👍👍

  • @DreamySleepyDrowsy
    @DreamySleepyDrowsy Рік тому +2

    I love this guy! He explains all the function of python so well, it really makes me want to learn more. Keep it up!

  • @Mark-po2xb
    @Mark-po2xb 4 роки тому +501

    You know that a tutorials going to be good when u have an indian talking :)

    • @CE--AhmedShabahat
      @CE--AhmedShabahat 3 роки тому +27

      Ya absolutely Indian English is easy to understand for both indians as well as others

    • @Avighna
      @Avighna 3 роки тому +14

      @TerrorWest lol ur being self racist. I think it's good

    • @m-gendy1512
      @m-gendy1512 3 роки тому +6

      @TerrorWest yeah, I agree with you it's really annoying special when his accent has so much effect on the English characters so, I really have so much respect for Indians who can overcome his accent those are only Indians who can really impress me

    • @Avighna
      @Avighna 3 роки тому +5

      @@m-gendy1512 wow ur as bad as that white police

    • @37.vigneshgopal3
      @37.vigneshgopal3 3 роки тому +5

      @@Avighna Actually like it is annoying because for coding we Indians have only watched tutorials by foreigners and we get addicted to that sound. Plus Indian accent if heard on devices is very annoying to be it anyone. NotRude

  • @cipher8400
    @cipher8400 4 роки тому +20

    59:00
    (just letting myself know where i left off)
    EDIT 2: Finished :)

  • @shreyanshsoni1138
    @shreyanshsoni1138 3 роки тому

    You are the best teacher I have ever met on youtube

  • @souvik_saha
    @souvik_saha 3 роки тому +46

    1:06:00 these 2 conditions can be simplified as
    if enemyX = 736:
    enemyDx = -enemyDx
    enemyY += enemyDy
    this way the enemy speed value can be modified in the global only instead of changing in 3 different places

    • @rikthecuber
      @rikthecuber 2 роки тому +4

      Yeah.
      Working with variables is much more comfortable than putting numbers.

    • @adhirajsingh1806
      @adhirajsingh1806 Рік тому +1

      Ok but how do you make them return to 0 or 736 depending on if they end up less than 0 or more than 736

    • @hl-life8738
      @hl-life8738 8 місяців тому

      ​@@adhirajsingh1806You don't have to. He already changed the movement direction. For example, enemy approach a border and turn back instantly and go to opposite direction with the same speed.

  • @walrusdaboss5162
    @walrusdaboss5162 3 роки тому +32

    I watched the whole thing. THANK YOU SO MUCH.
    I learned so much.
    Legend.

  • @ixbx897
    @ixbx897 2 роки тому +1

    Thank you so much! I have been wanting to learn how to make a game with python for ages!

  • @ashishj4672
    @ashishj4672 4 роки тому +7

    Started and completed the whole course in 4 hrs no skips and not discontinuty... Just because of the way this guy explains Stuff..

  • @leweed3049
    @leweed3049 3 роки тому +6

    i needed 3 days to finish, but now i am way smarter and understood it

  • @cakiilunicorn7929
    @cakiilunicorn7929 2 роки тому

    Man, this helps me a lot. I srsly struck gold with yt recommendation huh.
    Lots kudos!

  • @draregerreip
    @draregerreip 4 роки тому +4

    Fantastic... one of the best tutorial I have seen ... if maybe a bit too detailed for me (with a bit of experience in programming you can fast forward some parts even if you are a beginner in python as me). One comment on something I found missing. For the continuous movement of the spaceship to function properly I had to add apygame.key.set_repeat(10) in the initialization part. Without it, it would only take one keystroke at a time (took me one hour to understand why it didn't work as shown on the screen.

    • @d_gs
      @d_gs 4 роки тому

      I was just wondering the same thing. Thanks!

  • @mderra8012
    @mderra8012 3 роки тому +22

    2:00:25
    - "And when we shoot someone"
    *Misses drasticaly

  • @Phanight
    @Phanight 2 роки тому +1

    Salute , you sir 🙏
    you made a two hour video and subtitles too
    It surely took you so much time

  • @pakdestalin9685
    @pakdestalin9685 4 роки тому +39

    I have an exam tomorrow and i watch this video till the end.
    *Yep thats worth it*

    • @serenabrowne4517
      @serenabrowne4517 3 роки тому +2

      i have two weeks to make a game and I have to learn this, plus I have school for one more week.
      *ill be fine right?

    • @chickmagnet2067
      @chickmagnet2067 3 роки тому

      I watched it on exam day. Love freecode camp

  • @flutterreference6876
    @flutterreference6876 4 роки тому +19

    Awesome tutorial, I like it😁👍
    By the way, I recently found a tutorial which helped me a lot while following this one. It will help you a lot especially if you are from India. The channel name is NSP Tech. Enjoy 😁

  • @mateusz11123
    @mateusz11123 3 роки тому +1

    Thank you soo much! It's soo good that you comment every thing you writhe using the #, it's VERY VERY helpful for beginners! :)

  • @marlonsolleske7466
    @marlonsolleske7466 3 роки тому +3

    Really cool coding exercise covering the basics. Great fun while following throw it and playing with the functions here and there. Keep up the good work and kindly share more courses like this one. Also looking forward to a object-oriented approach for games involving lots of sprites. Thanks again.

  • @Zjoway
    @Zjoway 3 роки тому +5

    :( im stuck at bullet movement. bullet is not appearing

  • @7guitarlover
    @7guitarlover 3 роки тому +1

    Image resize issue
    If you cannot get a 64x64 bit image then use the transform command like this -
    enemy_alien1 = pygame.image.load('Enemy_Alien1_Image.png')
    enemy_alien1 = pygame.transform.scale(enemy_alien1, (64,64))
    (it converted the enemy alien img into a 64x64 bit image and stored it into your enemy_alien1 variable)

  • @pastorfred2543
    @pastorfred2543 5 років тому +442

    I still can't figure out why this channel is so amazing with its video contents and on top of that ABSOLUTELY FREE.

    • @harshlahoti8368
      @harshlahoti8368 4 роки тому +3

      ikr

    • @motozeu_vlgs
      @motozeu_vlgs 4 роки тому +11

      This channel is pure HEAVEN!

    • @samuelamare3080
      @samuelamare3080 4 роки тому +22

      Don't give them any ideas

    • @Red-yq6nc
      @Red-yq6nc 4 роки тому +15

      @@@samuelamare3080 Dont worry this will always be free they have a paid version which is like an other site named CodeAcademy. However i like how the quality of the content is so high but it still is free, its like standfords free machine learning course videos

    • @themoneyhive2820
      @themoneyhive2820 4 роки тому +1

      they still get ad money bruh

  • @lakshmikanthmhetre2833
    @lakshmikanthmhetre2833 3 роки тому +16

    some how after adding sound effect the game feels soooo cool... well by the way must complete the full tutorial. its gr8.

  • @juanjosesantibanez2452
    @juanjosesantibanez2452 2 роки тому

    I saw all the adds until the end to help this guy

  • @solomonleo3025
    @solomonleo3025 3 роки тому +18

    49:30 lol, at least you said something to laugh during the tension! 😂😂

  • @denaldohuggins2816
    @denaldohuggins2816 3 роки тому +3

    I can't express how happy I am for this video

  • @dotboyclay
    @dotboyclay 3 роки тому

    Lots of fun to follow along with , im new to coding and these codecamp tutorials are my best friend atm LOL

  • @tatwik1042
    @tatwik1042 3 роки тому +16

    I nearly played this game for 1 hour while creating it... :)

    • @greengoblin5488
      @greengoblin5488 3 роки тому

      I set the number of asteroids to 5000 and I reached a score of over 3 million

  • @ajmalnayeem7881
    @ajmalnayeem7881 3 роки тому +6

    Just made a shooting game
    Fear me Elon Musk

  • @anuragsaini8689
    @anuragsaini8689 2 роки тому

    You made it vey nicely and easy. Please keep making tutorials like this so we can learn more. Thank you for investing your time for us. Lots of love for you.
    Thankyou again.

  • @mentor1324
    @mentor1324 4 роки тому +15

    ⌨️ (0:00:00) Installing Python and Pycharm
    ⌨️ (0:04:12) Creating Our First Game Window
    ⌨️ (0:12:39) Changing the Title, Logo and Background Color
    ⌨️ (0:20:33) Adding Images into Our Space Invader Game
    ⌨️ (0:29:57) Movement Mechanics in Game Development
    ⌨️ (0:38:13) Keyboard Input Controls & Key Pressed Event
    ⌨️ (0:49:53) Adding Boundaries to Our Game
    ⌨️ (0:53:28) Creating the Enemy
    ⌨️ (0:59:14) Movement Mechanics of the Enemy Space Invader
    ⌨️ (1:06:51) Adding a Background Image
    ⌨️ (1:12:08) Creating Bullets for Shooting
    ⌨️ (1:26:21) Shooting Multiple Bullets at Space Invaders
    ⌨️ (1:34:24) Collision Detection
    ⌨️ (1:48:05) Creating Multiple Enemies
    ⌨️ (1:55:08) Adding Text and Displaying Score
    ⌨️ (2:03:17) Adding Sounds and Background Music
    ⌨️ (2:09:05) Game Over
    --

  • @NB-ph6cv
    @NB-ph6cv 3 роки тому +26

    funny thing, after the code was done for multiple enemy i was into it "for real"

    • @tuis6276
      @tuis6276 3 роки тому +1

      Can you send the codes please :(

    • @hamzawarsi1834
      @hamzawarsi1834 3 роки тому

      @@tuis6276 why not just watch the video, it will be worth your time

  • @sachinmahale6003
    @sachinmahale6003 3 роки тому

    This was really a very good tutorial. What I noticed is that, if your computer speaker is disabled, then you will face an error :- "Module pygame has no attribute 'rfind'".

  • @kanny8742
    @kanny8742 4 роки тому +18

    feels so good to see our Desi boys conquer the internet

  • @animelegendsxy9278
    @animelegendsxy9278 2 роки тому +11

    You are really a good teacher . I don't know why but i guess Indian college would be disappear in the upcoming years if legends like you keep teaching.
    Keep going it love you 3000
    The things we learnt in 2 hours in this video our college's will take more than 1 month to cover all of this method .....

  • @GetRealwithMike
    @GetRealwithMike 9 місяців тому

    You should make something like this for teachers to teach certain chunks of knowledge and then the person can play if they get the answers right. Work, then play, then work, then play

  • @njrocks8606
    @njrocks8606 4 роки тому +43

    This tutorial was amazing, I've learned so many concepts in python game development.

    • @vladusa
      @vladusa 3 роки тому +2

      Python wasn't really designed for it.. it is really important, though, to apply Pygame knowledge to future computer vision projects (if you choose to do so). CV2 is super valuable in combination with pygame and blitting.

  • @manthilaranatunga5142
    @manthilaranatunga5142 3 роки тому +18

    This was a really good tutorial. He explained everything in detail. Highly recommend.

    • @topeverthing5963
      @topeverthing5963 3 роки тому +1

      How do you add an image/icon to Pycharm? I had a lot of trouble trying to import a logo for the icon

  • @captainarvoy2551
    @captainarvoy2551 2 роки тому +2

    10:01 instead of changing value of running to false we can write pygame.quit() to end the loop then and there and not going through rest of the code in the while loop, thus making quitting the game faster.

    • @shivanshmishra8395
      @shivanshmishra8395 2 роки тому

      Then an error is coming at screen fill of
      Display syrface quit

    • @paula19335
      @paula19335 2 роки тому

      Can you please help me? it looks like you know what is happening in this game. I got at the part when shooting multiple bullets but I can only shot one and that's it. Also when I try to type if bullet_syate IS ready it doesn't let me. It say syntax error and that I can't use it with a string. PLS HELP! i'm not native

  • @abishekta8797
    @abishekta8797 Рік тому +10

    Very beginner friendly, you have taught in a step by step manner that allows us students to try them out , which is very helpful and needed. Thank you .

  • @zicraftian
    @zicraftian 3 роки тому +3

    got "SyntaxWarning: "is" with a literal. Did you mean "=="?
    if bullet_state is "ready":" and not sure if I should keep it as "is" or change it to "==" to remove the angry red text

    • @felixriddle
      @felixriddle 3 роки тому +2

      Is recommended to use == in this case

    • @zicraftian
      @zicraftian 3 роки тому

      @@felixriddle Thanks for this

    • @pizzaisneat
      @pizzaisneat 2 роки тому

      Ok i know this is 6 months ago but the bullet doesn't show up ?
      Is there anything that I can do
      Nvm fix it no clue I just think my space bar is dog water

    • @zicraftian
      @zicraftian 2 роки тому

      @@pizzaisneat coding really do be like that sometimes

    • @paula19335
      @paula19335 2 роки тому

      Do you have any idea why my bullet only shots once and then it stops? I can't shot the second time. I'm stuck. I'm not native

  • @anshumansharma1069
    @anshumansharma1069 2 роки тому +1

    thanksss sirrrr ...love this rideee ❤️❤️❤️❤️❤️😍😍😍😍💐💐💐💐🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @justinmccoy4270
    @justinmccoy4270 3 роки тому +14

    Great tutorial bruh, really easy to follow along to without speed up or slow down on video play speed. Didn't slow talk the basics like it's somehow news that a String can be a variable value or something. Just gets right into a python library and explains how to build a game.

  • @dushyantkumar4704
    @dushyantkumar4704 4 роки тому +14

    Hey,
    getting this error,
    if event.type == pygame.QUIT():
    TypeError: 'int' object is not callable

    • @hydra1346
      @hydra1346 4 роки тому +11

      Dushyant Kumar no brackets on QUIT

    • @caelbrenning4763
      @caelbrenning4763 4 роки тому +4

      No brackets

    • @hichewy6748
      @hichewy6748 4 роки тому +3

      @@hydra1346 had the same probmem. it works now! thanks.

    • @FatmanVA
      @FatmanVA 4 роки тому +1

      remove the brackets from quit

    • @retr0dragon450
      @retr0dragon450 4 роки тому +2

      Remove the brackets from beside the quit.

  • @mclarenf1gtrlmedition715
    @mclarenf1gtrlmedition715 3 роки тому +1

    This video cured all my mental disease and problems.

  • @fdisk-l
    @fdisk-l 3 роки тому +8

    "So its thinking about its existence and the meaning of life and what's happening to me.... So we are going to give it a meaning in the next video so i'll see you over there" (;

  • @Jotaro-o
    @Jotaro-o 3 роки тому +14

    Great tutorial! After watching I made it so the enemies could fire bullets to make it a bit more interesting

    • @diablos2933
      @diablos2933 2 роки тому +1

      Just to Clarify would you take the spaceships shooting speed and then put it on an enemy sorry for asking a stupid question I am New to Python

    • @hello-wx9wh
      @hello-wx9wh 2 роки тому

      how did u set at what place the bullets will spawn?

    • @harigopaladamus9481
      @harigopaladamus9481 2 роки тому

      @@hello-wx9wh the enemy variables

  • @debokikantalahirichowdhury4986
    @debokikantalahirichowdhury4986 3 місяці тому +1

    PNG file image is not loading in mine, the image does not get loaded, when I try to run the code, it shows "Unsupported Image Format" !! What should I do ??

  • @shiveshkushwaha204
    @shiveshkushwaha204 4 роки тому +8

    Thank you so much Sir..... After 5 days i have created this game with the help of your video.....

    • @planet.ai1
      @planet.ai1 4 роки тому +1

      Which pubg

    • @urara4477
      @urara4477 4 роки тому +2

      👈@@planet.ai1 nahi bro bro mera channel dekho

  • @boikimphore7845
    @boikimphore7845 3 роки тому +14

    To center player along x-axis can also be auto-calculated instead of hardcoding playerX = 370
    playerX = screen.get_width() / 2

    • @mbrown1253
      @mbrown1253 3 роки тому +2

      technically this would place the left edge of playerImg at center. to align the center of playerImg at the center of the screen you'd need:
      playerX = screen.get_width() / 2 - playerImg.get_width() / 2

  • @yasmeengrewal7369
    @yasmeengrewal7369 3 роки тому +2

    completed the tutorial. Yayyy! thanks for the amazing tutorial.

  • @Uncreeperble
    @Uncreeperble 4 роки тому +90

    2hr 15min tutorial - takes 8 hours for me to complete....
    Complete the installing python + pycharm part xD

    • @tahaahmed6655
      @tahaahmed6655 4 роки тому +6

      Totally true for me 'coz I pause and type in the same code after he adds a word to his code - gotta stop doing that though

    • @DrWho2008t101
      @DrWho2008t101 3 роки тому +1

      good job

    • @TamakoYT
      @TamakoYT 3 роки тому +2

      bruh, I've watched it 3 days already

    • @Jiggly12
      @Jiggly12 3 роки тому +1

      internet speed didnt go brr

    • @TamakoYT
      @TamakoYT 3 роки тому

      @@Jiggly12 speedn't

  • @user-fp1vg1ob4n
    @user-fp1vg1ob4n 4 роки тому +15

    49:42 that made me laugh and 😢

  • @_aamir4694
    @_aamir4694 3 роки тому +1

    Please answer my question that how do i add image underneath main.py like how you did it my image adds next main.py and when i wrote this player = pygame.image.load('spaceship.png') it says this file is not here and even though i added the image next to it

    • @dileepkm3940
      @dileepkm3940 3 місяці тому

      Go to the file of your python project and paste the img

  • @souravsenapaty4738
    @souravsenapaty4738 4 роки тому +5

    I have a problem. When both the left and the right keys are pressed, the ship moves towards the direction which was instructed last. But when any one of the 2 keys are released, the ship stops. I need it to move towards the pressed key's direction

    • @lakshyajhambani1410
      @lakshyajhambani1410 4 роки тому +1

      bro meri bhi same problem h

    • @edwardnygma4785
      @edwardnygma4785 4 роки тому

      Me too, please, if you find a solution - or anybody else. PLEASE. Post it here. I've been trying all sorts of things and none of it seems to work...

    • @yuvraj6013
      @yuvraj6013 4 роки тому +1

      instead of using events use the pygame.key.get_pressed() method by doing this
      in the while loop
      keys = pygame.key.get_pressed()
      if keys[pygame.K_LEFT]:
      playerX -= player_vel
      elif keys[pygame.K_RIGHT]:
      playerX += player_vel
      and it should work

    • @edwardnygma4785
      @edwardnygma4785 4 роки тому

      @@yuvraj6013 Hi, please help me. My problem is this:
      If I hold down the right key and keep it held down AND THEN hold down the left key, it switches to go left. If I then release the left key, it switches to go right.
      However,
      If I hold down the left key and keep it held down AND THEN hold down the right key (or press the right key) it just keeps on going left... Please please help, I can't wrap my head around a solution.

  • @maniiiisha
    @maniiiisha 3 роки тому +18

    Getting your Oscar ready.
    It was like a damn good crash course.

  • @032ithaseeb9
    @032ithaseeb9 3 роки тому +1

    For those encountering problem while closing game window:
    event.QUIT only checks whether quit button has been pressed or not. To quit python you need to set loop condition as False. This sometimes causes problems. So, first quit the pygame window, exit the program and then close python.
    Code:
    //at top
    from sys import exit
    //rest of the code is same
    //in the if condition: "event.type == pygame.QUIT"
    pygame.quit()
    exit()
    running = False

    • @shincoma
      @shincoma 2 роки тому

      thanks for the tips :)

  • @okidokie8
    @okidokie8 4 роки тому +7

    At 17:43, he said something wrong.
    The less the value of a certain colour is, the darker it is not the lighter. Just correcting it for you guys out there so u dont get confusef

  • @zenawesum2078
    @zenawesum2078 2 роки тому +5

    Tip : those who can't get the image or logo in pygame window, just add the png in the folder where ur game's/.py file is

    • @shurikengamer5645
      @shurikengamer5645 Рік тому

      Also if we have a path that involves back slash rather than typing one type 2 backslash. Like C:\\Users\
      ame\\game\\pic.png

  • @Zjoway
    @Zjoway 3 роки тому +2

    dont know if im doing things incorrectly, but "is" doesnt work for me and instead I use ==

  • @Iknowpython
    @Iknowpython 5 років тому +6

    pygame is really cool when it comes to 2-D game development

  • @Jammy3270
    @Jammy3270 3 роки тому +3

    16:00 one problem i had was the icon was too big, so instead it just displayed the python logo, to fix this change it to around 32x32

    • @DavidTasselTots
      @DavidTasselTots 2 роки тому

      # Enemy
      enemyimg = []
      enemyX = []
      enemyY = []
      enemyX_change = []
      enemyY_change = []
      num_of_enemies = 10
      for i in range(num_of_enemies):
      enemyimg = pygame.image.load("alien.png")
      enemyimg = pygame.transform.scale(enemyimg, (64, 64))
      enemyX.append(random.randint(0, 735))
      enemyY.append(random.randint(50, 150))
      enemyX_change.append(2)
      enemyY_change.append(40)
      This is what my code looked like to accommodate for a different sized picture. My enemies were so big they were spawning off screen with a small portion of them on screen.

  • @AnastSid
    @AnastSid 3 роки тому +1

    this video is helping alot and for my other i games

  • @Zamerus
    @Zamerus 4 роки тому +4

    I'm only at the part where you make the game window but keep getting an error despite doing exactly as shown in the video. I don't know how to fix it if it's pycharm being broken or some such
    this is the error (and yes I have pygame installed)
    line 13, in
    if event.type == pygame.QUIT():
    TypeError: 'int' object is not callable
    edit: I rewatched for a 5th time and saw what I did wrong haha! The brackets should have been removed

    • @sevilnatas5431
      @sevilnatas5431 4 роки тому

      yeah, was about to day that

    • @1ceyMan
      @1ceyMan 4 роки тому

      you can just delete () after QUIT and all right 😉😉

  • @yovhal1980
    @yovhal1980 4 роки тому +36

    He: which you have played in your childhood.
    13 yrs old me: pretty sure I haven't

  • @logi-operations
    @logi-operations 3 роки тому +1

    ah yes, that one guy who has the exact instructions I needed. Thank you !

  • @kais.8235
    @kais.8235 4 роки тому +107

    42:49 (where I left off so I can remember)

    • @michaelandillocr
      @michaelandillocr 4 роки тому +5

      I just right clic and copy the url on the actual minute xD

    • @kais.8235
      @kais.8235 4 роки тому +4

      @@michaelandillocr Thannk you!

    • @ItzRaiyan
      @ItzRaiyan 4 роки тому +5

      You haven't finished it yet don't stop yet you can do it!

    • @kais.8235
      @kais.8235 4 роки тому +2

      Thanks!

    • @jamarimcfarlane4844
      @jamarimcfarlane4844 4 роки тому +2

      Hey finish the course lazy......

  • @letslearn6352
    @letslearn6352 3 роки тому +5

    1:03:00
    it can be done in vs code, using alt+click trick.

  • @ruhikaragul3620
    @ruhikaragul3620 3 роки тому +1

    awesome video as your pronunciation.thx much

  • @moeilijk888
    @moeilijk888 3 роки тому +3

    When im at the section: if bullet is "fire": I get the syntaxWarning "is" with a literal. Did you mean "=="? I can't play the bullet. What I'm I doing wrong?

    • @a.a8720
      @a.a8720 2 роки тому

      He is using an older version of Python, just add == instead of “is” and it should work.

    • @paula19335
      @paula19335 2 роки тому

      @@a.a8720 Can you pls help me? I am at the part when shooting multiple bullets but it shots one and then it stops. Do you know how to fix? I'm not native

  • @sagarikaray3936
    @sagarikaray3936 4 роки тому +72

    I'm a 12 year old and it's really very easy learning Pygame with you . Keep it up!!👍👍

  • @OmnionicX_YT
    @OmnionicX_YT 11 днів тому

    Im indian and I think this man has destroyed everyone's expectations of our english

  • @anonymouscode1616
    @anonymouscode1616 3 роки тому +6

    How many guys are noticed this amazing guys voice was changed in the class of adding audio to game

  • @saisankalp25
    @saisankalp25 3 роки тому +3

    I have searched a lot of videos for pygame but none was as good as this
    Thank you

  • @dadgamer6717
    @dadgamer6717 10 місяців тому

    Thank you! Been looking for a way to create multiple enemies. We were using the Actor framework but with a bit of help with bing I managed to make a matrix of actors and used things like bird = [] and bird[i].x etc thanks!

  • @krishnans2006
    @krishnans2006 4 роки тому +5

    [1:36:20] I would have instead used:
    if 0 < bulletX - enemyX < 32 and 0 < bulletY - enemyY < 32:
    as that makes sure the bullet is touching the enemy, since the enemy is a square and not a quarter circle.
    Edit: You could also use bullet.get_rect() and enemy.get_rect to then check for collisions using pygame.sprite.groupcollide() or pygame.sprite.spritecollideany()

    • @paula19335
      @paula19335 2 роки тому

      Can you please help me? it looks like you know what is happening in this game. I got at the part when shooting multiple bullets but I can only shot one and that's it. Also when I try to type if bullet_syate IS ready it doesn't let me. It say syntax error and that I can't use it with a string. PLS HELP! i'm not native

    • @jakobolsen1867
      @jakobolsen1867 Рік тому

      @@paula19335 change to bullet_state == "ready", same with below code, bullet_state == "fire"
      Once you get the below lines to work you will be golden!
      if bullet_state == "ready"
      bulletX = playerX
      fire_bullet(playerX, rocketY)

  • @davidmace1856
    @davidmace1856 4 роки тому +14

    1:03:00 Sorry for the mistakes in English (I'm French). Yes there is a way to do it quicker. You select the block you want to change. You go to Edit > Search > Replace you press Ctrl + R to replace only things that are in selection. Then you type player in the search field and enemy in the replace field. Please like so as many as possible know this trick.

    • @5staryzzz
      @5staryzzz 4 роки тому

      Your English is Perfect

    • @davidmace1856
      @davidmace1856 4 роки тому

      @@5staryzzz Thanks your comment make me happy especially from you 😉

    • @5staryzzz
      @5staryzzz 4 роки тому

      @@davidmace1856 Lol, np

    • @davidmace1856
      @davidmace1856 3 роки тому

      @saketh p Yeah 🤣

  • @alright7131
    @alright7131 3 роки тому +2

    sir I am not able to change The background and I am following the steps you are telling

  • @brennancampbell2409
    @brennancampbell2409 4 роки тому +5

    ive followed along every step and im stuck on getting 6 enemies to appear ive looked over my code multiple times to try to figure out where the problem is but im stuck, when i shoot my bullet sometimes it dissapears mid screen so i feel as if the enemies are there but they just arent visable

  • @mcrafterpro563
    @mcrafterpro563 4 роки тому +8

    me: pauses for a second to check comments
    also me: sees somone have a link to 40 mins in
    also also me: checks how long video is
    video: 2 hours

    • @samwichvr485
      @samwichvr485 3 роки тому +2

      Wait, did u not c the huge "learn python in 2 hours" ?

  • @apurvlall7552
    @apurvlall7552 3 роки тому +1

    Thank you for this best tutorial ever for making python game

  • @templeOfChrist1994
    @templeOfChrist1994 3 роки тому +3

    Best way to learn when watching these videos for me at least was to watch each section, example: displaying the window, adding icon. Then go and try it yourself without re watching that section. If you run into a problem remembering what he typed just go look it up and search around instead of just re-watching what he typed out. Thank you for these videos!

  • @novartisnk9684
    @novartisnk9684 4 роки тому +7

    well this is one of the best tutorials that I've seen.
    It's so easy to understand and well-explained also those recaps after each lesson are so awesome
    Thank you so much 🙏🙏

  • @mayankpant1596
    @mayankpant1596 2 роки тому

    If you are coding in jupyter and it is telling you that no 'pygame' module is available, you need to install it manually.
    Go to anaconda shell and type "pip install pygame". After completion check again and see if it works.

  • @walterbush5541
    @walterbush5541 3 роки тому +17

    Tip:
    If for whatever reason you cant set a variable to true, set it to 0 or 1 and do
    while running == 0:
    thingy.do_some_crap
    Edit:
    Frick me nvm you have to capitalize true or false

  • @TreBros
    @TreBros 3 роки тому +8

    Awesome Tutorial! Thank you for the spread of your knowledge! Super grateful for people like you who take the time to explain how and why it works and why it does not! That is definitely good teaching practices! I wish my CS teachers were as good as you when it comes to explaining the internals of code! Much appreciated! Take care!

  • @neito7103
    @neito7103 3 роки тому

    The way you teach is amazing.

  • @kibble43
    @kibble43 3 роки тому +4

    You just earned yourself a like !

  • @TheBidnessmanHimself
    @TheBidnessmanHimself 3 роки тому +7

    who else is watching this in 2021 and wanting to start a fiverr account? -->

  • @bilaluludag
    @bilaluludag 2 роки тому

    nice tutorial! now ill try to add score multipliers difficulty and etc. myself. i hope i can do it!