Re: Python (Trouble with Aliens!)

  • From: BlueScale <bluescale1976@xxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 17 Apr 2009 07:44:24 -0400

Hi,
That did the trick, now, though those aliens seem to have gone and
vanished altogether.  Is it ok if I contact you off list with some code?
There are several different files, so would be kind of hard to post
everything here.
Thanks
On Fri, 2009-04-17 at 05:27 -0600, Tyler Littlefield wrote:
> dam them troublesome alians, eh? ;)
>  
> What your doing is a for each loop:
> for i in alians.
> Basically it's going to go through the list of alians, and i gets
> assigned to the new alian, so you would use something like:
> i.move()
> rather than alians[i].move
> etc
> HTH,
>  
> 
> Thanks,
> Tyler Littlefield
> Web: tysdomain.com
> email: tyler@xxxxxxxxxxxxx
> My programs don't have bugs, they're called randomly added features.
> 
>         ----- Original Message ----- 
>         From: BlueScale 
>         To: programmingblind@xxxxxxxxxxxxx 
>         Sent: Friday, April 17, 2009 5:17 AM
>         Subject: Python (Trouble with Aliens!)
>         
>         
>         
>         Hi,
>         I am having some trouble with my aliens.  Here's the code:
>         for i in aliens:
>           aliens[i].move()
>           if aliens[i].getxpos() == x:
>            lockOn.play()
>         The error I am getting is:
>         TypeError: object cannot be interpreted as an index
>         Can someone please help me make my aliens behave better?
>         Thanks 

Other related posts: