Centering Images & Clean Rotation - Pygame Tutorial

preview_player
Показать описание
This video completes my mini-series that covered rotation and related topics in Pygame. Centering is how you get clean rotations in Pygame with the wonky image resizing Pygame does when you rotate an image. In general, centering is useful for a bunch of stuff.

Code Written in Video:

Related Videos:

Discord:

Twitter:

This video and the code produced in it are released under: CC0 1.0 Universal (CC0 1.0). This puts the video and code produced in it in the public domain, so use it for whatever you want.

#pygame #python #gamedevelopment
Рекомендации по теме
Комментарии
Автор

Hi, this was so much more concise than other advice I found on internet forums, regarding the centred rotation of images. Thank you for the tutorial, it was very helpful!

anthonyma
Автор

Tysm, i just needed 1 line of code to fix rect rotation, bruuh.

AcceleratedVelocity
Автор

This is such a good tutorial, straightforward and simple!

alboris
Автор

Hi, this is an amazing video, although I have one question, how do you rotate aa sprite around a point other than its center?

mustafakhan-foun
Автор

THANK YOU SO MUCH! I'm trying to recreate flappy bird in pygame, my second project with this library and first not following any sort of tutorial (big mistake), I was stuck on rotating a blit for like a week, it sort of worked, but the animation was jagged and then it didn't. Now the rotation when "flapping" and falling is much MUCH smoother and doesn't crash the program if spammed

Frnk
Автор

What if i want my center to be height/2 width/3 instead of height/2 width/2?

hectik
Автор

Is there a way to better optimise this method? I think using the virtual attributes of the Rect class (topleft, center, etc) might simplify and speed up the code. However, I tried doing that and I could only make it work by following the original code exactly

mingyi
Автор

Hey DaFluffyPotato if you dont remember me i asked on one of your videos related to the tile rendering

I am now writing a pygame wrapper called PygameVBO
I just did a performance test and i have over 1000 FPS while having images render to the screen


I am going to make sure everything capable of being done in normal pygame is doable in PygameVBO
VBO stands for visual batch omitting


I will have a git available for everyone soon, it's a little project i've been working on.

Visual Batch Omitting is another way of batch rendering** - Directly updating the surface with no calls

I am going to be doing a bench mark to make sure there is a improvement before i start lurking lol

Malsavahara
Автор

I wonder how you can apply this, so that the mechanics are like in the game contra 3. The player looks up, and the field rotates, rotate with the mouse

antonkorotkov
Автор

Good job so far on ur channel 👍👍👍 keep up

dreamwork
Автор

Very helpful. I needed this. Because animating this good is hard. Rotating a sprite is better and easier!

rmr_md
Автор

thanks cause i just wanted a way to draw and rotate images kind of like how easy drawing a primitive shape is.

YOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Автор

love your videos man, please make a video on multiple enemies spawning without stacking :)

angelmaden
Автор

How do you make the movement smooth in your games (not jittering every second)? Does using delta time help? Thanks in advance!

robertspakarklis
Автор

+DaFluffyPotato could you pls pls pls make a tutorial about moving platforms? ty!

cauchy_math
Автор

Thank you very much!
Like, subscribe and best wishes to you

АнтонНазарук-щс
Автор

I need help,
If I had a clock my movement isn't smooth anymore.

qxt-soqi
Автор

when I load my image it counts it as a string and gives me an error

vishalputtagunta
Автор

Hi the link is broken it does not open

nejatulusal
Автор

Спасибо большое, очень помог(нет(да))

Китоблатов
welcome to shbcf.ru