Pygame Tutorial - Part 7 - Object Orientation in Pygame

preview_player
Показать описание
Learn to create your own 2D-Video Games using the module Pygame with Python. In this video we will introduce an object-oriented approach to building games with Pygame.

◾◾◾◾◾
🎬 Overview 🎬

Previous Episode:
6️⃣ Pygame Tutorial - Part 6 - Character Animation with Sprites

Next Episode:
8️⃣ Pygame Tutorial - Part 8 - Shooting

◾◾◾◾◾
💳 Attribution:

📷 Sprites and Images:
- Background: Dylan Squires

👪Related Content

◾◾◾◾◾ 🌎 Let's Connect! ◾◾◾◾◾

🌟 Please leave a LIKE and SUBSCRIBE for more! 🌟

Hashtag: #Pygame
Рекомендации по теме
Комментарии
Автор

Nice tutorial. I have a few small points that I like your view on:
1) stepIndex is modified in both Hero.move_hero and in Hero.draw. Maybe it would be better if draw does not change this variable and that it would be completely set by move_hero.
2) Maybe move_hero could just be named move because it is a member function of hero.
3) Having two variables face_left and face_right seems a bit unneeded. I would choose face_right and test for 'face_right' or 'not face_right'
4) I learned that in some cases Pygame can be sped up by using '.convert()' on the loaded images.
5) When running from Winpython/spyder the pygame window did not close after clicking the window close icon. By adding pygame.display.quit() and pygame.quit() below the run loop this was resolved but that may not be ideal.

richardbloemenkamp
Автор

you can determine that offset by subtracting .getwidth() of your player sprite from game sure that the horizontal coordinate of your screen shouldn't exceed that distance..

kaustubhkapare
Автор

Hi there, great Video as always. Just one question: you forgot the stationary variable. Surely it should goes to the def move_hero, butter exaxtly where? If you answer this in the following videos, just ignore my Q. I'm going through all of them ^^

Rick_
Автор

How do I get the individual characters quickly, because if I crop them all from the website, it would take a long time and also not have an invisible background? Please help!

peterfalmry
Автор

I have a problem my variable (player = Hero(250, 290)) is not working can you help me

projectgame
Автор

this is exactly like tech with tim’s code🤔

f.m
Автор

Thanks a lot man that's an amazing video. You helped me a lot. 🤍

Nevan
join shbcf.ru