Python Space Invaders Game Tutorial with Pygame - Beginner Tutorial (OOP)

Поділитися
Вставка
  • Опубліковано 4 лют 2025

КОМЕНТАРІ • 50

  • @programmingwithnick
    @programmingwithnick  Рік тому +3

    I hope you took away lots from this video. Let me know below!
    PS: I created a course named "Object Oriented Programming Made Easy"! Sign up at bit.ly/3NaMfg4. I think you will enjoy it!

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

    Its funny how overexcited youre are but also very helpful you explain everything from ground up. Good stuff!

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

    Great work Nick, brings back memories when the game came out on an arcade machine in the local pub.

  • @thegrayfox666
    @thegrayfox666 24 дні тому

    This tutorial was great and really fun to follow! thank you

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

    Thank you bro! Very good tutorial!
    I used this to make a school project!

  • @marcoantonioramirezsolis6275

    Thanks for your tutorials, Nick. You rock and with your teaching method, I have retaken my career in game development. You rock :D

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

    Fantastic coding exercise - I learnt lots of new tricks. Such a great game too ! Thanks.

  • @rutsoluo
    @rutsoluo 6 місяців тому

    Amazing video, being able to program a game like this is a childhood dream come true to me

  • @anthonydrakefordshadow
    @anthonydrakefordshadow 6 місяців тому

    Great lesson, you are a very gifted instructor!

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

    This is amazing tutorial, congratulations bro 👌👌

  • @lukemacnamara4514
    @lukemacnamara4514 Місяць тому

    the left and right arrow keys aren't working. the def get_user_input(self): function doesn't seem to work? Would there be a reason. I have double / triple checked the code? Never used this group sprite thing before ?

  • @Charlotte-b9w4y
    @Charlotte-b9w4y 3 місяці тому

    Thank you this tutorial is amazing.

  • @Jordan.Data.Analyst-i7h
    @Jordan.Data.Analyst-i7h 3 місяці тому

    Right now, I just got to the spot where you check to make sure that only 1 laser is shot at a time. I have everything exactly as you do and the inputs are not working. I cannot move the spaceship left or right, nor does the spaceship shoot lasers. Please help.

  • @goodlookinouthomie1757
    @goodlookinouthomie1757 10 місяців тому +2

    At 40:44 it would be nice if you explained _why_ we can now delete half of the code we've written in the last half hour. Because I have no idea 🙄

    • @andyryan4484
      @andyryan4484 4 місяці тому

      I know its a long time now but basically we wrote test code in the main program loop to show and check operation but then put it all in functions in the Game class to neaten up the code and make it more logical. It does feel a bit like... "but I just wrote that!"

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

    Hi Nick, thanks again for another wonderful tutorial :)
    I think you forgot to add in the offset for the laser sprites and the right-side spawn of the mystery space ship seems to be off.

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

      Thanks for the feedback. For the laser sprites, we don't need to add an offset because they spawn at the center of the spaceship, or the alien sprite, so the offset is already there. As for the mystery ship, I will check it again, you may be right. Thanks again!

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

      @@programmingwithnick I meant the laser sprite when it should be destroyed once it reaches the edge of the frame we have drawn

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

      Good catch! You are right! We need to destroy it a bit earlier now that we have the frame. Thanks for letting me know.

    • @justcode194
      @justcode194 11 місяців тому

      The right side spawn of the mystery ship you need to minus the offset not add it "x = random.choice([self.offset/2, self.screen_width - self.offset - self.image.get_width()])"

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

    Welcome back Nick! Will there be a C++ version of this?

  • @oscar3824
    @oscar3824 4 місяці тому

    ¡Gracias!

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

    Bạn đã giúp tôi gỡ rối rất nhiều thứ, cảm ơn nha 🤗, video rất tuyệt, hãy ra nhiều hơn nhé.

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

    Great !! really well explained (oop+flow) to follow
    I'm using your example to update a breakout revision !!
    Have you another tutorial with spritesheet on a simple platform game ?
    Thanx for your time :)

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

    loved it thanks--but did have a problem --with the screen size not fitting my laptop and if I want to increase levels and if it is in there--how do I start the next level after clearing the first one. making the next level harder than the last. free ship would be nice after clearing a level or after reaching a certain score.

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

    Great video thank you for your work

  • @sonicdasher5656
    @sonicdasher5656 Рік тому +3

    How can I make this go on forever until I loose all 3 lives?

  • @andyryan4484
    @andyryan4484 4 місяці тому

    Is there any chance someone could explain to me why some of the spritecollision lines are True and some are False - I get the operation of the code but just know one of my kids is going to ask me and I'd like to be able to give an intelligent answer.

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

    Raylib version of this would be great

  • @johnniegilkerson4724
    @johnniegilkerson4724 22 дні тому

    @29:0 my spaceship will not move at all.

  • @flamzy284
    @flamzy284 11 місяців тому

    Day 1:
    1:00:00

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

    Hello how can I add a python file ?

  • @eltalPreciado
    @eltalPreciado 6 місяців тому

    thanks bro !

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

    Is pygame more featureful than rsylib python bindings

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

      Yes, pygame has many more features which make game development faster.

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

      thanks, I tried pygame in 2020 when I was just learning how to program. Now I'm using C and raylib but I wondered if I returned to python whether I should use raylib bindings or pygame.@@programmingwithnick

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

      When I left pygame few years ago (switched to pyglet), it was hopelessly slow wrapper for SDL with no hardware or graphics API support. Since then it seems it's development has accelerated significantly.

  • @TheWerirdOnes
    @TheWerirdOnes 11 місяців тому

    there's no download scammer.

    • @programmingwithnick
      @programmingwithnick  11 місяців тому

      Can you see the link to the github repository? The code is there, free to download for everyone.

  • @oscar3824
    @oscar3824 4 місяці тому

    ¡Gracias!

    • @programmingwithnick
      @programmingwithnick  4 місяці тому

      Now I need to "heart" this comment twice but UA-cam won't let me. Thank you very much for your support!