2D Vector Movement - PyGame Thursdays 26
Вставка
- Опубліковано 4 лип 2024
- In this video we'll learn how to use 2D Vector Movement for Platformer Games in Pygame and Python.
Movement gets more interesting when we account for Position, Velocity, and Acceleration.
We can do that using Kinematics, (physics) and we'll learn how in this video...
#pygame #codemy #JohnElder
Timecodes
0:00 - Introduction
1:26 - Define a 2D Vector
2:47 - Kinematic Vectors
4:55 - Kinematic Constants
6:40 - Update Function Movement
9:28 - Calculate New Kinematics
12:19 - Update Rect
13:35 - Set Initial Acceleration
14:48 - Tweak Friction
16:10 - Conclusion
▶ Watch PyGame Playlist ✅ Subscribe To My UA-cam Channel:
bit.ly/3PSSreL bit.ly/2IGzvOR
▶ See More At: ✅ Join My Facebook Group:
Codemy.com bit.ly/2GFmOBz
▶ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
Take 50% off with coupon code: youtube50 bit.ly/2VC9WUN
▶ Get The Code
bit.ly/469BaDR
The acceleration being in the position update is because the acceleration is continuously changing velocity, so you're accounting for how much more distance is being added by the variable velocity. Also the equation is from d1 = 0.5 * a^2 * time + v0 * time + d0 so your acceleration should have been squared... regardless I offer this, if it helps your understanding: it's because acceleration is changing velocity while velocity is changing position, so we're accounting for that change in velocity (and thus extra position change) between steps or frames or seconds with that 0.5*a^2. In a silly sense, the frame rate of the universe is infinity per second.
Impressive. Very nice.
This kinematics lesson level up this amazing pygame course !!!
Yep! Fun stuff!
Hi John, I'm enjoying this playlist, but I've run into a problem with my code. When I start the program, pushing the arrow keys does not move Aspen. I've compared your code to my code and I've written all the kinematic equations and key selections correctly. This is very confusing as I've not run into any problems until this point.
Edit: I figured out what was wrong; I didn't realize the equation that calculates the new acceleration was a minus equals instead of just equals. My program works fine now!
@@racingfan372 Glad to hear you got it goin!
There's a website called textcompare that I use for exactly this scenario.
why we skipped 25?
Just forgot to tag it in the playlist…it’s there now.