On 25 September 2011 06:33, Paul <[email protected]> wrote:
> monsters = []
>
> @window.event
> def on_draw():
>        window.clear()
>        if (len(monsters)) < 10:
>                for M in monsters:
>                        monsters.append(monster(x= 200,
> y=random.randint(20, 480)))
>                        monsters.M.draw()
>        map.blit(0, 0, 0)

The monsters code in there is effectively a no-op (looping over the
empty monsters list). If there was a monster in the list then you'd
(hopefully) get an error from Python because you were mutating the
monsters list while iterating over it.

I suspect what you want to do is:

monsters = []
for i in range(10):
      monsters.append(monster(x=200, y=random.randint(20, 480)))

@window.event
def on_draw():
      window.clear()
      for M in monsters:
           M.draw()
      map.blit(0, 0, 0)


    Richard

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to