By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Using pygame.Surface.blit inside class

P: 2
I can call my class only one time.
My code is:

Expand|Select|Wrap|Line Numbers
  1. class fish:
  2.     def __init__(self, x, y, image, speed):
  3.         self.x = x
  4.         self.y = y
  5.         self.image = image
  6.         self.speed = speed
  7.     def be(self):
  8.         screen.blit(self.image, (self.x, self.y))
  9.         self.x -= self.speed
  10.         if boot.x+36 > self.x and boot.x < self.x+5:
  11.             if boot.y+34 > self.y and boot.y < self.y+5:
  12.                 boot.live -= 1
  13.                 boot.x = 100
  14.                 boot.y = 460
fishes = []
fishes.append(fish(900, 300, fish_1, 1))
And when I call 'fish' object inside or outside the game loop(
Expand|Select|Wrap|Line Numbers
  1. fishes.append(fish(900, 300, fish_1, 1)
) I got Error:

Expand|Select|Wrap|Line Numbers
  1. TypeError: 'fish' object is not callable
Apr 27 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.