Alan Gauld wrote: > "Tonu Mikk" <[EMAIL PROTECTED]> wrote > > >> I create more robots in this way which seems to work: >> class Robot: >> pass >> > > By using an empty class you are losing m,uch of the power of classes. > > I would need to learn more to handle the classes better. In this case, I am following the Livewires tutorial pretty closely which uses an empty class. >> def move_robot(): >> for x in robots: >> while 1: >> if robot.x + 0.5< player.x and robot.y +0.5< player.y: >> > > You are doing *for x in robots* but then moving *robot* not x. > Yes, that was my mistake. I changed the line to "for robot in robots:" and now it works! > > Also it would be better IMHO to use if/elif rather than all those > if/breaks. > I followed your advice here. It does make the code a bit more clear.
Thanks a lot, Tonu _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor