Debugging in Pygame

  Рет қаралды 14,232

Clear Code

Clear Code

Күн бұрын

How to access information in order to debug games. The major problem we have to overcome is that the game loop produces too much output if we use the if statement. This video goes through how to create a debug panel to access information, which makes debugging drastically easier.
If you want to support me: / clearcode
(You also get lots of perks)
Social stuff:
Twitter - / clear_coder
Discord - / discord

Пікірлер: 35
@tarantula0071
@tarantula0071 3 жыл бұрын
Apriciate it! It is really hard to keep making new topics on pygame, especially tutorials! Great job!
@MustafaTuncay..
@MustafaTuncay.. 3 жыл бұрын
Hello, I am really happy that you are preparing these tutorials, so thank you. Can you also show us how to make inventory systems in pygame? Or you already planned?
@rudomir-__-2929
@rudomir-__-2929 6 ай бұрын
Thanks, it's way better than print debugging, and here is the source code (i changed names a bit and add offset of '10' by default): import pygame pygame.init() font = pygame.font.Font(None, 30) def logd(info, y=0, x=0): surface = pygame.display.get_surface() text = font.render(str(info), True, 'white') rect = text.get_rect(topleft=(x + 10, y + 10)) pygame.draw.rect(surface, 'Black', rect) surface.blit(text, rect)
@Bonfere
@Bonfere 3 жыл бұрын
good job! This is what i needed for my code
@Klannahar
@Klannahar 3 жыл бұрын
If u want to make it a little bit more advanced, maybe u can put it in a class so it can keep track of the debug texts, and can auto adjust the nex text pos. Maybe a bit over complicating, but it can be helpful is some situation. But anyway it is a nice one, and i should start using something like this instead of print :D So far did not had that much problem debuging with print. Most bugs come from my stupidity such as refering to a list when i recreate the list instead of use its own clear method, and then wondering why my projectile is still keep moving after it collided with an enemy. :D This one made me headache. But could find it out when i print out the list memory adress and could see 2 different function using 2 different adress.
@RATANAGARWALITINFORMER
@RATANAGARWALITINFORMER 3 жыл бұрын
good topic
@jk-gn2fu
@jk-gn2fu 2 жыл бұрын
Could you please do a tutorial about simple shaders? Such as: simple 2d lighting (day and night, torches), outline, water effect, glow effect. I really need these tutorial.
@mohiuddinsyed1684
@mohiuddinsyed1684 3 жыл бұрын
It would be really good if you introduced type hints in the debugging file. It would help us what exactly it takes and does, or returns.
@carlfranz6805
@carlfranz6805 Жыл бұрын
Generally, on a Black background, the colour that is most legible (for most people) is Yellow.
@dennys.1880
@dennys.1880 2 жыл бұрын
Hey i always have a problem where everything i write past exit() comes as code is unreachable and i have tried everything and i cant fix it. Do you have any idea why. It might be a simple code like the one from 1:18 but still it doesn't work .
@ClearCode
@ClearCode 2 жыл бұрын
I think you are messing up the indentations.
@dennys.1880
@dennys.1880 2 жыл бұрын
@@ClearCode i did it and still no. anyway thanks
@sasore76
@sasore76 2 жыл бұрын
Thank you
@shinyduck5324
@shinyduck5324 3 жыл бұрын
tysm, this was rlly useful!
@angadsingh6478
@angadsingh6478 3 жыл бұрын
Please start kivy🙏 and thanks for this tutorial
@chigstardan7285
@chigstardan7285 3 жыл бұрын
Yess!!! Kivy!!!
@maxfarouk3407
@maxfarouk3407 Жыл бұрын
You are too amazing!
@lahalrahman4916
@lahalrahman4916 2 жыл бұрын
Please make a tutorial on endless runner 2d game in Godot
@Derpy999
@Derpy999 3 жыл бұрын
interesting concept!
@Damrok3
@Damrok3 2 жыл бұрын
the moment i pressed the like button under this video was when you showed the cute pixel cat
@seed5743
@seed5743 3 жыл бұрын
What app do you use to code ?
@affezippel7214
@affezippel7214 3 жыл бұрын
it's a bit offtopic, but I just noticed when trying to implement this debug function in my code. Does anybody know why I get the error "TypeError: invalid color argument" when passing colors in as string ? screen.fill((0,0,0) works, but screen.fill('black') doesn't (so does every other color of the colordict in pygame documentation when I pass it as a string)
@ClearCode
@ClearCode 3 жыл бұрын
might be because of an outdated pygame version
@affezippel7214
@affezippel7214 3 жыл бұрын
@@ClearCode I thought I'm on the latest version... better to check. upgraded from 2.0.0dev6 to 2.0.1 and it works now. Thanks!
@MrTega1975
@MrTega1975 3 жыл бұрын
Debug package for sublime text is not useful?
@bishnuprasadpahari3780
@bishnuprasadpahari3780 2 жыл бұрын
why aren't new videos comming
@chigstardan7285
@chigstardan7285 3 жыл бұрын
Pls start kivy for ios/Android since it runs pygame under the hood.
@SkyFly19853
@SkyFly19853 3 жыл бұрын
By Cython as well. That makes it very fast. Even IronPython...
@pranavxd4606
@pranavxd4606 3 жыл бұрын
BEST KZbinR!
@bishnupahari3353
@bishnupahari3353 3 жыл бұрын
amazing
@azgaming5304
@azgaming5304 3 жыл бұрын
Please tutorials on algorithms like A* Game AI 🙏🙏🙏🙏🙏🙏🙏🙏🏿🙏🏿🙏🏿🙏🏿🙏🏿
@pradeep6514
@pradeep6514 2 жыл бұрын
Want some AI based games brother. 🙏🙏🙏 !!!
@imperialmuffin
@imperialmuffin 3 жыл бұрын
FiRsT view comment and like!!!
@leestons
@leestons 2 жыл бұрын
First to comment, last to get laid
@imperialmuffin
@imperialmuffin 2 жыл бұрын
@@leestons :(
Saving and loading in pygame with json
25:23
Clear Code
Рет қаралды 29 М.
Cameras in Pygame
1:13:21
Clear Code
Рет қаралды 120 М.
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 1,4 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
Creating an animated button in Pygame
32:49
Clear Code
Рет қаралды 35 М.
Pygame Sprite Animation
18:57
Neal Holtschulte
Рет қаралды 5 М.
Easy pathfinding in python [almost without math]
1:11:12
Clear Code
Рет қаралды 85 М.
Understanding framerate independence and deltatime
29:22
Clear Code
Рет қаралды 41 М.
Simulating physics in Python
23:21
Clear Code
Рет қаралды 134 М.
You should use enums more often
5:20
Lio Goes Indie
Рет қаралды 1,4 М.
Learning Pygame by making Pong
28:39
Clear Code
Рет қаралды 206 М.
Creating Space Invaders in Pygame/Python
1:54:50
Clear Code
Рет қаралды 124 М.
Understanding Pygame masks
1:00:29
Clear Code
Рет қаралды 40 М.
Python / Pygame Tutorial: Animations with sprites
14:25
Clear Code
Рет қаралды 118 М.