Skip to content
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

Merged
merged 11 commits into from
Jun 6, 2021
Merged

Create grenade object #52

merged 11 commits into from
Jun 6, 2021

Conversation

amanda-f-ndsu
Copy link
Collaborator

No description provided.

… test case, and updated bounds for setting fuse-time in grenade
@amanda-f-ndsu amanda-f-ndsu requested a review from HagenSR June 5, 2021 20:49
Copy link
Owner

@HagenSR HagenSR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POG

Copy link
Collaborator

@erickbickler erickbickler left a 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
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Owner

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

Copy link
Collaborator

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

Copy link
Collaborator Author

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

@erickbickler erickbickler merged commit 8389e9e into dev Jun 6, 2021
@erickbickler erickbickler deleted the Create-Grenade-Object branch June 6, 2021 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create grenade object
3 participants