so i am learning to code games from a video coding tutorial series. And my current problem is that when i run the game I get the following error:
File "/home/dev/PycharmProjects/Game6_Flappy_Bird/modules/sprites/bird.py", line 33, in update self.unsetflapped() AttributeError: 'Bird' object has no attribute 'unsetflapped'
The code from the "bird class sprites file code:
self.is_flapped = False
self.down_speed = 0
self.up_speed = 9
self.bird_idx = idx
self.bird_idx_cycle = itertools.cycle([0,1,2,1])
self.bird_idx_change_count = 0
def update(self, boundary_values, time_passed):
if self.is_flapped:
self.up_speed -= 60 * time_passed
self.rect.top -= self.up_speed
if self.up_speed <= 0:
self.unsetflapped()
self.up_speed = 9
self.down_speed = 0
else:
self.down_speed += 40*time_passed
self.rect.bottom += self.down_speed
is_dead = False
if self.rect.bottom > boundary_values[1]:
is_dead = True
self.up_speed = 0
self.down_speed = 0
self.rect.bottom = boundary_values[1]
if self.rect.top < boundary_values[0]:
is_dead = True
self.up_speed = 0
self.down_speed = 0
self.rect.top = boundary_values[1]
self.bird_idx_change_count +=1
if self.bird_idx_change_count%5 == 0:
self.bird_idx = next(self.bird_idx_cycle)
self.image = list(self.images.values())[self.bird_idx]
self.bird_idx_change_count = 0
return is_dead
def setFlapped(self):
if self.is_flapped:
self.up_speed = max(12, self.up_speed+1)
else:
self.is_flapped = True
def unsetFlapped(self):
self.is_flapped = False
I have checked this against the source code provided by the tutor and it matches exactly so I'm hoping someone can point me in the direction of what i'm doing wrong.