Friday, January 7, 2011

Jan 7

Okay well starting off today I had to input the tankgame.py. Well I put in all the code as the book told me to do but when i went to run the program its saying I have an error. I'm gonna read a little more on the next couple pages to see if that was suppose to happen.
OK well I've fixed the first problem, but now its saying theres a new error on line 3 instead of line 1. It says object___new__() takes no parameters. I really don't understand what it means but ill keep working on this to see if I can fix this.
Thanks to Mr. Elkner, I found out that i need instead of 1 _ for def _init_(self, name):, I need to have it like this: def __init__(self,name). This error also happened when I named who was being fired at and who was being hit, the code error was: def _str_(self) when I needed def __str__(self).

1 comment:

  1. In your previous posts you mention getting up to dictionaries, but I don't see any mention of OOP (Object Oriented Programming). In Python this means class, __init__, __str__, etc. You will need a pretty thorough understanding of writing OOP programs in Python before you can effectively tackle Pygame. Let's talk today about how you could go about that this week.

    A good place to look for resources: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

    ReplyDelete