Tutorial 37.18 - Adding Artwork and Animation (PyGame Python)

preview_player
Показать описание
Right then, we start getting into the knitty gritty of the game development, and we start with creating a game template in pygame that can be used for all game development within the python / pygame development system.

And then developed a simple player sprite that moves about the screen.

In this video we start to add the artwork to the game, and implement basic animatiom for the main sprite ;)

Bring It ON!!!!

Would you be so kind in supporting me on Patreon, If so, here is my Patreon page at

Twitter : @OldSkoolCoder

Patreon Co-Producer :
Stuart Hurst

Patreon Producers :
Juergen Pichler
Mark Shepard
G^Ray Defender
Raven
Matt Kasdorf

Patreon Assistant Producers :
John DiLiberto
Julien Nadeau Carriere
James Bearss
Dr Craig S. Bruce
Shallan (Simon Jameson)
HybridGrid
Adam Sommer
Gregor Gramlich
Amok
RetroGameDev (Derek Morris)
Dale Andrew Darling
WauloK
JMLaniel
Docster
AndyMagicKnight
GaryMeg
Brandon Redmond
Cyb3rfly3r

Patreon Associate Producers :
Peter Martin
Jeffery T Birt
James Taylor
Robin @ 8 Bit Show And Tell
Karl Tylman
SPBarryHercules
Ben Wood
Michael Nielsen
Justin
Stacy Bates
Geoff Archer
Richard Sopuch
Antonio Bianchetti
Jesus Garcia
Mike Richmond
Stuart Garnham
Zerfall
TriGaDe
Phaze101
KnightFire
Edi Frankovic
RetroSteve
Lycoris4
Mark Kaufmann
David Pickford
Wayne Bushby

#Hunchback #PyGame #Python
Рекомендации по теме
Комментарии
Автор

I also noticed that when running this code, the player was always moving after when going left than right. 

I found that this is caused by rounding the position when passing it to the rect.center (lines 30 and 45). To fix this, I removed line 57 and then put self.position.x = self.rect.center[0] at the end of the if starting at line 33 and put self.position.y = self.rect.center[1] at the end of the if starting at line 47. That way, the x and y position is corrected only if it needs to be corrected. 

effect ofself.acceleration.x += self.velocity.x * settings.PLAYER_FRICTION. The friction reduces the acceleration (actually, the total force acting on the player), no the velocity directly. I think it doesn't change the result the way it was programmed, but it makes a difference from a physics point of view.

jmlaniel
Автор

What is the purpose of the if statement at line 35 of player.py ? This seems to be a statement for the y coordinates since it checks the bottom of the player and the top of a wall.

jmlaniel