[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Creating surfaces



Thanks, that solves that problem. :D

On Mon, Jun 14, 2010 at 8:06 PM, Kris Schnee <kschnee@xxxxxxxxxx> wrote:
On 2010.6.14 7:44 PM, 音本四 wrote:
Traceback (most recent call last):
  File "C:\Users\Jaychant\Documents\Games\senso.py", line 111, in <module>
    game = Game((640,480), (0,0,0), (0,200,0))
  File "C:\Users\Jaychant\Documents\Games\senso.py", line 54, in __init__
    self.p1 = Player(0,0,(100,100),lncolor,0,(8,64),(16,8))
  File "C:\Users\Jaychant\Documents\Games\senso.py", line 93, in __init__
    self.sprite =
pygame.Surface(size[0]+gunsize[0],max(size[1],gunsize[1])).convert()
ValueError: size needs to be (int width, int height)

Here is what the important variables end up being:
size: (8,64)
gunsize: (16,8)

What I gather from this is that I'm not specifying an integer where I
should be. But I've checked the arguments; The first becomes 8+16=24,
while the second becomes 64.

Can anyone see what's wrong? Am I misinterpreting the error?

I think the key is that the size must be given as _one_ variable which is a two-part tuple. So, change the line:

pygame.Surface(size[0]+gunsize[0],max(size[1],gunsize[1])).convert()
To:

pygame.Surface( (size[0]+gunsize[0],max(size[1],gunsize[1])) ).convert()


Hope this helps.

Kris



--
--音本