[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] bidimensional arrays or the quick way to maps
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] bidimensional arrays or the quick way to maps
- From: "Ulf Ekström" <uekstrom@xxxxxxxxx>
- Date: Tue, 4 Sep 2007 22:11:27 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 04 Sep 2007 16:11:35 -0400
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DZyu9YyAgG4Pc2+1ndfcIQxw9oWAydshZP6mcnoyX+ZwmZAA+vSNLtTXWcEwk8Ojmj231kUxaO8GvaeLUh2lic5xYOlaTuPml8yAo/8AycpM4N3aCqWRxi/E+gTN+R5BGFzetubRqg49srUwnsQooPDez6VogqanaihR7OisLSE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WYiuEI5qh6iTQcr5K6JduGPLY2SNAtxKxrpbeyHp1ojHOcQ4QDBhToFRhwRoEykquSkDnx77pKTinxmEVGoxvibDSaex45MbGkqJePNxdFFMZH5wMgLOGo2oz5Kp/gRkf4pv2Mq8Q+RciszGeVvz11qJJLmRHk/Toj3kpgTMOR8=
- In-reply-to: <46DDB533.90805@xxxxxxxxx>
- References: <46DDB533.90805@xxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
You can use lists of lists, for example with a function like
def makearray(w,h):
a = []
for i in range(w):
a.append([None]*h)
return a
Then you adress the elements like a[2][3]. This is probably not very
efficient, but for maps it should be ok.
Ulf