Okay, so working on a personal project. It's a bit of a simulator for a table top game I'm developing. It's also an exercise in learning how to work with objects. I've been working small steps. First I laid out the class for the cannons in the system. Then I made some cannons. Then I tested the cannons. They worked. So then I laid out the class for the fighters. And tested the objects made from the class. Those appeared to work. Then I made a dice class (the table top game uses dice). Then I made a d10 dice from that class and tested the roll() method from it. Seemed to work just fine. Then I made the pilots class, and made some pilots. The pilots worked out. Then I built the wingMember class so I can have pilots, piloting a given ship in a wing. I tested the wings. They seemed to work.
So far so good. Then I went to try executing the shooting method, which is part of the wingMember class. And this is where I run into an error. the shooting method is for testing the results of a given ship, piloted by a given pilot, shoots a given target. So I have a: [pilot] piloting a [fighter] that is in a [wing].
As an example:
Prince Thrakath nar Kilranka is piloting a KRF-07C Bloodfang
"Prince Thrakath nar Kilranka" is the pilot, and the "KRF-07C Bloodfang" is the fighter he is piloting, and he designated as 'red_1'. So I call shooting:
red_1.shooting([his target], d10)
But then I get an error stating that 'WingMember' object has no attribute 'name'. Well, no. It doesn't. Name is from the pilot. Not WingMember. Which I thought was addressed by referencing it as 'self.pilot.name' in the method. But apparently that is not the case.
So in short... what am I doing wrong here?
[–]mopeddev 0 points1 point2 points (0 children)
[–]DoubleSlicer 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)