[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] how hexcolour arrays works?
- To: pygame-users@xxxxxxxx
- Subject: [pygame] how hexcolour arrays works?
- From: "Paulo Silva" <nitrofurano@xxxxxxxxx>
- Date: Mon, 28 Jul 2008 11:49:43 +0100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 28 Jul 2008 06:49:48 -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:mime-version:content-type:content-transfer-encoding :content-disposition; bh=onimJQctpA7PGs8UqJyoUrMy0T0xObRVZD/XdZ3aslk=; b=mci6i2CHS6au4pVl25CqP+ZogBBdTGPnstX7iMizojUOf1sFOfzdgGUo3h2v9fy5QV RjWdSc5Wds5KvP9jYf5dH6vTm+iP2PyLQF30hr1zAAnzaSkWoouRkTdO1HfK+rTDx65e bK4GrSKutcHhSyNQMgt4k+pR/uV5DH7QPMuE4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=em73OgXFhnpdaa67NPUnqx4RGj/e++kZecpASZBwl09bSTxP9qqUp+UR4+gMpv4Th5 TlO05pHWF1I8sMQCQi1czytMOzuDr4Q8ouLSxhw8WHClsgbQ4XodCHQS4u+rf6hoDLgb n/K3ihAkojFT+SMsZ/y34I3++6TQBAldsTGFM=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi, i'm having problems on defining a hexcolour array - weird is i
never have this kind of problem when defining a string array in the
same way...
This may look as a very naive mistake, but i got really stuck, since
even from google searches i can't get any help...
Thanks a lot in advance... :-)
import pygame,random
pygame.init()
a=[]*8 #- same as 'dim a[8]' from sdlBasic?
a[0]=0x883746;a[1]=0xA88721;a[2]=0xBDE87A;a[3]=0xEE875F #- list
assignment index out of range?
a[4]=0xFE98A1;a[5]=0x334836;a[6]=0x374838;a[7]=0xAAB398
screen=pygame.display.set_mode((320,240));bkgd=pygame.Surface(screen.get_size());bkgd=bkgd.convert();bkgd.fill(a[random.random()*7])
pygame.display.set_caption("move a box")
box=pygame.Surface((25,25));box=box.convert();box.fill(a[random.random()*7])
box_x=0;box_y=100;clock=pygame.time.Clock();kpg=True
while kpg:
clock.tick(30)
for event in pygame.event.get():
if event.type==pygame.QUIT:kpg=False
box_x+=5
if box_x>screen.get_width():box_x=0
screen.blit(bkgd,(0,0));screen.blit(box,(box_x,box_y));pygame.display.flip()