Pygame TypeError: python.surface object unsubscriptable
Here is the code:
Expand|Select|Wrap|Line Numbers
- ball1 = [ 100 ,50 , 1, 0]
- def ball (x,y,movex,movey):
- if x < 0 :
- x * -1
- if x > 580:
- x= x* -1
- if y < 0:
- y = y* -1
- if y > 260:
- y = y*-1
- x+= movex
- y+= movey
- return x ,y
- ball1x = ball1 [0]
- ball1y = ball1 [1]
- ball1x ,ball1y = ball( ball1x, ball1y ,1 ,0 )
The function will work with real number though.i.e
Expand|Select|Wrap|Line Numbers
- ball1x , ball1y = ball ( 10 , 450, 1 ,0)
Expand|Select|Wrap|Line Numbers
- ball1 [0], ball1 [1] = ball( 10, 405, 1 ,0 )
Also, everytime I get an error like this after I create the pygame window I can't close the window and it become unresponsive.
I there any fix to that?
thank!
mahem1