Pygame Tutorial for Beginners - Python Game Development Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024

ความคิดเห็น • 3.2K

  • @traumaterasu
    @traumaterasu 3 ปีที่แล้ว +781

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

    • @37.vigneshgopal3
      @37.vigneshgopal3 3 ปีที่แล้ว +19

      Indians rock bro. Wait r u indian????

    • @object5369
      @object5369 3 ปีที่แล้ว +1

      You are so much true

    • @object5369
      @object5369 3 ปีที่แล้ว +1

      @@37.vigneshgopal3 l am Indian. I am proud

    • @traumaterasu
      @traumaterasu 3 ปีที่แล้ว

      @@object5369 yeaaaa

    • @7a53vinay4
      @7a53vinay4 3 ปีที่แล้ว

      Yea man

  • @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 ปีที่แล้ว +645

    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

  • @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!

  • @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 5 ปีที่แล้ว +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

  • @abishekta8797
    @abishekta8797 ปีที่แล้ว +11

    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 .

  • @rakstar343
    @rakstar343 4 ปีที่แล้ว +1989

    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

  • @walrusdaboss5162
    @walrusdaboss5162 3 ปีที่แล้ว +33

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

  • @stephimalzkorn
    @stephimalzkorn 2 หลายเดือนก่อน

    You come up with the idea of a game, teaching everything one needs to accomplish it. Much better than any book or tutorial I ever read!

  • @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.

  • @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 .....

  • @_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

  • @pakdestalin9685
    @pakdestalin9685 4 ปีที่แล้ว +41

    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

  • @manthilaranatunga1
    @manthilaranatunga1 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

  • @saisankalp25
    @saisankalp25 3 ปีที่แล้ว +3

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

  • @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.

  • @sagarikaray3936
    @sagarikaray3936 4 ปีที่แล้ว +73

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

  • @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

  • @pinkdolphin8017
    @pinkdolphin8017 4 ปีที่แล้ว +180

    Only this man can make a spaceship question their existence

  • @njrocks8606
    @njrocks8606 4 ปีที่แล้ว +43

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

    • @vladusa
      @vladusa 4 ปีที่แล้ว +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.

  • @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 ปีที่แล้ว +2

      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 ❤️

  • @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 9 หลายเดือนก่อน

      ​@@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.

  • @cipher8400
    @cipher8400 4 ปีที่แล้ว +20

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

  • @kiranprasad987
    @kiranprasad987 2 ปีที่แล้ว +1

    this is the best tutorial, no one teached properly like him for pygame.

  • @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

  • @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!

  • @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!

  • @spaceface2288
    @spaceface2288 4 ปีที่แล้ว +6

    Its good that you are repeating many things again and again, its actually really helpful for us, beginners as we tend to miss out on details sometimes.

  • @jwebbs999
    @jwebbs999 4 ปีที่แล้ว +10

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

  • @baibhabchakraborty266
    @baibhabchakraborty266 ปีที่แล้ว +2

    This is how teaching should be!!!🙏🙏🙏
    Huge respect, from a student to you, sir...

  • @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
    --

  • @sydneywatson6487
    @sydneywatson6487 4 ปีที่แล้ว +5

    Wow! You have answered all my questions! It's just like two weeks ago I said I wanted to make a game app and I had no idea at all where to start. So I began watching videos on TH-cam and I found your video. I am so greatful for your video bro. I certainly subscribed to your channel and I look forward to more of your educational videos. I know you said it's all basic stuff but bro, for me, oh men believe me, it's so professional that I would call it advanced. But you made it so logical and fun that I understood everything. Muchas gracias...Merci beaucoup.

  • @somshridhar
    @somshridhar 23 วันที่ผ่านมา

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

  • @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 😂😂😂

  • @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

  • @shreyanshsoni1138
    @shreyanshsoni1138 3 ปีที่แล้ว

    You are the best teacher I have ever met on youtube

  • @maniiiisha
    @maniiiisha 3 ปีที่แล้ว +18

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

  • @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 🙏🙏

  • @jessize4503
    @jessize4503 ปีที่แล้ว +1

    49:35 - The spaceship is lonely and thinking about its existence! Funny commentary! Great tutorial

  • @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..

  • @solomonleo3025
    @solomonleo3025 3 ปีที่แล้ว +18

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

  • @Addistoday
    @Addistoday ปีที่แล้ว

    አመሰግናለሁ!ከ ኢትዮጵያ በጣም ግሩም ድንቅ መምህር! እድሜህ ይርዘም!❤❤❤🏆🏆🏆🏆🏆

  • @denaldohuggins2816
    @denaldohuggins2816 3 ปีที่แล้ว +3

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

  • @Mark-po2xb
    @Mark-po2xb 4 ปีที่แล้ว +502

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

    • @CE--AhmedShabahat
      @CE--AhmedShabahat 4 ปีที่แล้ว +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

  • @ixbx897
    @ixbx897 2 ปีที่แล้ว +1

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

  • @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!

  • @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

  • @Maheshwar1524
    @Maheshwar1524 3 ปีที่แล้ว +1

    I want to press the like button 100000 times. This is the best video I have ever seen on this topic. Great Sir..keep it up.

  • @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.

  • @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!

  • @SophiaWoessner
    @SophiaWoessner ปีที่แล้ว +1

    Most enjoyable pygame tutorial on the interwebs

  • @leweed3049
    @leweed3049 3 ปีที่แล้ว +6

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

  • @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 🤣

  • @mateoingouville
    @mateoingouville 2 ปีที่แล้ว +1

    Thank you! I know less than jon snow about programming, but I followed your every step and I made my own game with my own cool graphics and story. And I think I understood most of it, even the collision part. Great teacher.

  • @mderra8012
    @mderra8012 3 ปีที่แล้ว +22

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

  • @anonymouscode1616
    @anonymouscode1616 4 ปีที่แล้ว +6

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

  • @abominablemusic
    @abominablemusic 5 หลายเดือนก่อน

    just finished this tutorial - it's great. Many thanks for making this and making it easy to follow.

  • @kanny8742
    @kanny8742 4 ปีที่แล้ว +18

    feels so good to see our Desi boys conquer the internet

    • @tahaahmed6655
      @tahaahmed6655 4 ปีที่แล้ว +1

      Yup dude. Desi Zindabad!

    • @abdulmueed2611
      @abdulmueed2611 4 ปีที่แล้ว

      @@tahaahmed6655 yes desi zindabaad

  • @Iknowpython
    @Iknowpython 5 ปีที่แล้ว +6

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

    • @buildwithpython
      @buildwithpython 5 ปีที่แล้ว

      True Story.

    • @batu-740
      @batu-740 5 ปีที่แล้ว

      @A Google User why not 3D

  • @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

  • @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

  • @DanielBooysenJR
    @DanielBooysenJR ปีที่แล้ว +2

    Really enjoying how he explains everything well. Bit tedious for when you know basics, but it is a really good course, def recommend

  • @letslearn6352
    @letslearn6352 3 ปีที่แล้ว +5

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

  • @yovhal1980
    @yovhal1980 4 ปีที่แล้ว +36

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

  • @Chainless_Slave7
    @Chainless_Slave7 2 ปีที่แล้ว +1

    Someone give this man a medal.

  • @kibble43
    @kibble43 3 ปีที่แล้ว +4

    You just earned yourself a like !

  • @ProgrammingwithPeter
    @ProgrammingwithPeter 5 ปีที่แล้ว +4

    Cool intro to python game development 💪

  • @bigsmoke6414
    @bigsmoke6414 3 ปีที่แล้ว +1

    only around 20minutes in, but already the best programming tutorial for this that i have ever seen

  • @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 😁

  • @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......

  • @thefounderofbussines645
    @thefounderofbussines645 2 ปีที่แล้ว

    i created my first ever game thank you so much bro
    the tutorial is not even bored .well understanding .no error

  • @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)

  • @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

    • @ahmedzarin2247
      @ahmedzarin2247 3 ปีที่แล้ว +1

      hahaahahahah underrated comment

  • @JeremydePrisco
    @JeremydePrisco 3 ปีที่แล้ว

    Thanks for posting. You approach works much better than several other resources that I've tried.

  • @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 4 ปีที่แล้ว +1

      good job

    • @TamakoYT
      @TamakoYT 4 ปีที่แล้ว +2

      bruh, I've watched it 3 days already

    • @Jiggly12
      @Jiggly12 3 ปีที่แล้ว +1

      internet speed didnt go brr

    • @TamakoYT
      @TamakoYT 3 ปีที่แล้ว

      @@Jiggly12 speedn't

  • @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

  • @tienmy4521
    @tienmy4521 10 หลายเดือนก่อน

    Although I struggle for 3 days, but nice for beginners like me. Thank you so much! Hope u have the best when prodiving very detailed and free-acess education for people!

  • @NB-ph6cv
    @NB-ph6cv 4 ปีที่แล้ว +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

  • @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" (;

  • @NPRojas
    @NPRojas 10 หลายเดือนก่อน

    Es una gran introducción a PyGame.
    ¡Felicitaciones!
    It is a great introduction to PyGame.
    Congratulations!

  • @ajmalnayeem7881
    @ajmalnayeem7881 3 ปีที่แล้ว +6

    Just made a shooting game
    Fear me Elon Musk

  • @rijaja
    @rijaja 4 ปีที่แล้ว +7

    3 hours were lost saying "hand side" after every "right" or "left".

  • @cakiilunicorn7929
    @cakiilunicorn7929 2 ปีที่แล้ว

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

  • @jorenvangoethem343
    @jorenvangoethem343 4 ปีที่แล้ว +5

    nice tutorial but you could make everything dynamic by using more variables, as example i set my initial space ship location to ScreenY - 100 and ScreenX*0.45 and this way it is always centered even if you change the screen size

    • @MrTomro
      @MrTomro 4 ปีที่แล้ว +1

      ScreenY - 100 isn't really dynamic, a better choice would be ScreenY * ( 5 / 6)

  • @Zjoway
    @Zjoway 3 ปีที่แล้ว +5

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

    • @henryhuels8
      @henryhuels8 2 ปีที่แล้ว

      how do i fix It!!!

  • @prasoonrajpoot4077
    @prasoonrajpoot4077 3 ปีที่แล้ว

    he ffucking explained the pygame library so easily that i cant define, i was stuck on understanding how to use them, these 2 hours are the most productive of my life.......more power to u bro, please give us an option to applaud your work through money...

  • @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

  • @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.

  • @misternoobie
    @misternoobie 3 ปีที่แล้ว

    Thank you for this. I missed coding with python and i don't know where to start again; this is a great start for me.

  • @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

    • @lakshyacuts
      @lakshyacuts 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.

  • @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.

  • @fdhyunseo
    @fdhyunseo 3 ปีที่แล้ว +3

    WOW! This tutorial is incredible! Thank you very much!

  • @zadiac_6976
    @zadiac_6976 4 ปีที่แล้ว +12

    i have a problem in the pic every time i am defining a pic they are telling me playerImg = pygame.image.load('the pic)
    py game error couldnt open super mario 1 png
    so what should i do

    • @aaronh4030
      @aaronh4030 4 ปีที่แล้ว +4

      I think i might have a solution to what you're asking. If you're using Pycharm, make sure that the png you are using isn't in your downloads, but instead in the Pycharm folder where all your projects should be. Once it's there, it should appear on the left side where you previous projects are and then you can continue with this tutorial!
      Hope this helps!

    • @aaronh4030
      @aaronh4030 4 ปีที่แล้ว +1

      @@zadiac_6976 Hmmm that's weird cuz that did the trick for me. The only thing I can say to that is maybe the file is corrupted, but i think you probably already thought of that and redownloaded it. Maybe try putting the images in a folder, putting it in the pycharm folder like before, and using the 'import os' method, which you can find explained in Tech with Tim's channel or just the pycharm website.
      Hope it works this time.

    • @zadiac_6976
      @zadiac_6976 4 ปีที่แล้ว

      @@aaronh4030 yeah btw i downloaded it like 3 or 2 times does that matter\

    • @aaronh4030
      @aaronh4030 4 ปีที่แล้ว +2

      @@zadiac_6976 maybe? Not really sure.

    • @zadiac_6976
      @zadiac_6976 4 ปีที่แล้ว

      @@aaronh4030 till now I don't know what to do I stopped from that time and I am now learning unity and 3d

  • @user-fp1vg1ob4n
    @user-fp1vg1ob4n 4 ปีที่แล้ว +15

    49:42 that made me laugh and 😢

  • @Phanight
    @Phanight 2 ปีที่แล้ว +1

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

  • @TechJolt3d
    @TechJolt3d 4 ปีที่แล้ว +9

    If anyone is having trouble opening images in mac. save the files to iCloud document

  • @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 😉😉

  • @dotboyclay
    @dotboyclay 3 ปีที่แล้ว

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

  • @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 3 ปีที่แล้ว

      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