467,229 Members | 1,380 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,229 developers. It's quick & easy.

Using pygame.Surface.blit inside class

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
  • viewed: 1061
Share:

Post your reply

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

Similar topics

1 post views Thread by Dipl. -Ing. Ashu Akoachere | last post: by
2 posts views Thread by Jacek Dziedzic | last post: by
3 posts views Thread by MattB | last post: by
13 posts views Thread by Bijoy Naick | last post: by
reply views Thread by Kristopher Wragg | last post: by
9 posts views Thread by Justin Voelker | last post: by
1 post views Thread by joshuabraham | last post: by
reply views Thread by Adict | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.