[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Storing images in a list
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Storing images in a list
- From: "Jake b" <ninmonkeys@xxxxxxxxx>
- Date: Mon, 16 Jun 2008 18:04:09 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 16 Jun 2008 19:04:14 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=T28ZO4YDpJdNOpsdOjtAjHmB80VUhfQiFbz2F/xN0kQ=; b=eFE/BzN74Ht3Yw+PGE4oYXOmyLXNMSTf/yxg43pCsjdeh+/Q8JGYW5TK3VtkXl3mUZ +8QzjSMWPHaZo8igKk19MNyQiZ2ea7EM0NKr7G5H+VSDvzBsWsrV6NRXcjpAABPTgOsD xxRHFc+YPgUEf8eRTsdx70tdRKmrm1eZVHKRs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=EF+DGFuPTm9pH1qDMZexlIgrAkJ1PmQjR07/xelm2MN15lXJDWsEbAx4gSoUweE9tg 1pKdLP9jeW67ertS+GLUi49+BGP05ElR4cSUf1lx+fSe+n3P/ah1cjoFXIKhbcgANO5r kz1o+mfqkNTWzP7bfipR1OKnnaK9g3vke/wss=
- In-reply-to: <4856E3B4.4040303@xxxxxxxxxxxxxxxxxxxxxx>
- References: <4856E3B4.4040303@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
> When an element of the list says <Surface 50x50x32>, is that pointing to a
> spot in the memory or is the actual image being stored in that index?
That's a surface. You can have multiple variables point to the same surface.
> Would I have 64 images in my list if every space is occupied or would I have just
> 2 images in memory?
I can't be sure without seeing your init/draw code, but it sounds like
you probably have 64.
Are you doing something like this?
def init():
"""game init"""
red = pygame.Surface( [10, 10] )
red.fill( pygame.color.Color( "red" ) )
blue = pygame.Surface( [10, 10] )
blue.fill( pygame.color.Color( "blue" ) )
# init tiles with color red
for tile in tile_list:
# sharing one surface for tiles
tile.image = red
def draw():
"""game draw"""
for tile in tile_list:
# draw using tile.image
--
Jake