Rotating an image around its center with arctan2 and math.Vector2 in pygame

DesignCodeDebugRepeat
DesignCodeDebugRepeat
193 بار بازدید - 7 ماه پیش - If you want to learn
If you want to learn python programming with the fun twist of learning pygame at the same time, you're in the right place!  In a prior video we looked at how to rotate Sprites around their center using atan2.  This video is an update that shows a very simple image rotation program solved with both atan2 and the pygame.math.Vector2 class that was new in pygame 1.9.2. Let's have some fun learning game programming with Python and pygame!

You can purchase the book that goes with this video series here as an ebook:
https://www.amazon.com/dp/B0B3V93YG9
or, if you prefer, as a textbook:
https://www.barnesandnoble.com/w/obje...

The original tangram rotation videos are here:
Rotating a sprite around its center i...

Here's a link to the Python math library documentation:
https://docs.python.org/3/library/mat...

And here's a link to the pygame.math library documentation:
https://www.pygame.org/docs/ref/math....

The github repository  with the code and assets for this video is here:
https://github.com/ProfessorBurke/Pyt...

The github repository with the code examples for the book and original video is here:
https://github.com/ProfessorBurke/Pyt...

If you want to earn credit for learning to code, take an online course at CCRI!  This video relates to the Beginning Game Programming courses:
https://ccri.edu/comp/

Coordinate system image was edited and is originally from:
https://upload.wikimedia.org/wikipedi...
Attribution:
TimWolla, Public domain, via Wikimedia Commons

00:00 Welcome!
01:02 Calculations overview
02:06 Quick trig review
03:13 math.arctan2 solution
09:46 pygame.Vector2 solution
7 ماه پیش در تاریخ 1402/10/29 منتشر شده است.
193 بـار بازدید شده
... بیشتر