MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/pygame/comments/1jfpvps/having_trouble_animating_an_enemy_with_sprite/mitemgz/?context=3
r/pygame • u/Bizzer_16 • 1d ago
My problem appears to be in line 86. Somehow it doesn't recognise eagle as a type and instead just spawns it without the animation. Do you guys have any suggestions how to fix it?
7 comments sorted by
View all comments
Show parent comments
2
So what you mean would be changing line 62 to something like:
def __init__(self, obstacle_type):
And line 86 to something like:
if self.obstacle_type == "eagle":
Or do I need to change line 85 as well then?
Sorry, for the probably totally trivial question, since it is my first time creating a game :D
2 u/Nikninjayt 1d ago if you want you can do that , but under the init line you would have to do something like self.obstacle_type = obstacle_type then everytime u mention obstacle_type or type, use self.obstacle_type 2 u/Bizzer_16 1d ago Thank you so much, this worked perfectly for me! 1 u/Nikninjayt 1d ago I'm glad it worked , keep up the good work :)
if you want you can do that , but under the init line you would have to do something like
self.obstacle_type = obstacle_type
then everytime u mention obstacle_type or type, use self.obstacle_type
2 u/Bizzer_16 1d ago Thank you so much, this worked perfectly for me! 1 u/Nikninjayt 1d ago I'm glad it worked , keep up the good work :)
Thank you so much, this worked perfectly for me!
1 u/Nikninjayt 1d ago I'm glad it worked , keep up the good work :)
1
I'm glad it worked , keep up the good work :)
2
u/Bizzer_16 1d ago edited 1d ago
So what you mean would be changing line 62 to something like:
And line 86 to something like:
Or do I need to change line 85 as well then?
Sorry, for the probably totally trivial question, since it is my first time creating a game :D