-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create grenade object #52
Conversation
…nade stats syntax, and updated + made fixes to other test_suite files
… from object_type in Grenade
… test case, and updated bounds for setting fuse-time in grenade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really close!
def __init__(self, fuse_time = GameStats.grenade_stats['min_fuse_time'], range= None, damage= None, | ||
heading = None, speed = None, health=None, coordinates=None, hitbox=None, collidable=None): | ||
super().__init__(range, damage, heading, speed, health, coordinates, hitbox, collidable) | ||
self.__fuse_time = fuse_time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use the property setting so it uses validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you clarify which line you're talking about? (I'm assuming you're talking about line 10, but just making sure). I'm looking at damaging_object and moving_object's def init statements and they're pretty much the same- so changes will need to be made to them as well if they weren't already fixed in dev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, line 10. The other objects need to be changed as well. If you do self.fuse_time = fuse_time that should use the property setter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, about that- when Sean was working on the clean-up refactor branch, he had initially done that for damaging_object and moving_object, but eventually switched them back to name mangling. We actually had a discussion on that in the pull request if you wanted to pull that up and take a read. For now, I'll wait to proceed until I get a general consensus from you and Sean on how the attributes should be done. The fixes would only take a few moments anyway so it isn't a big rush.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looked at the example I posted in dis. The backing variable comes from the property, you can use the property setter in the I init I think. I'll do some testing tonight or early tomorrow tho to double check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mk. I'll make the changes early tomorrow if need be. Sean mentioned something about problems with a recursive overflow, so it would be good to test and make sure that isn't happening prior to making the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erickbickler I think name mangling is still needed. In the example you can directly call the backing variable _temperature and change it to whatever without the property being invoked. The name mangling will prevent this and will ensure there are no "Accidental" accesses to the backing field.
test.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a question of name mangling it's whether you need to set the internal name mangled variable in the init or if you can use the property setter, if you look at the example init, it uses the property setter. ie self.temperature = temperature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attributes should be fixed now
No description provided.