Skip to content

Conversation

@mollthecoder
Copy link

Setting lifespan and damage to a negative number allows for a higher time alive or more damage taken before death than expected.
Every update, it checks if lifetime or damage are less than 0. If so, then set them to 0.

Note: I haven't updated the dist directory to reflect these changes. If you merge this PR into the game, please make sure to re-build it for me.

Setting lifespan and damage to a negative number allows for a higher time alive or more damage taken before death than expected.
Copy link
Owner

@MaxRobinsonTheGreat MaxRobinsonTheGreat left a comment

Choose a reason for hiding this comment

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

couple questions/change request

this.damage++;
if (this.damage >= this.maxHealth() || Hyperparams.instaKill) {
this.die();
if(this.die) this.die();

Choose a reason for hiding this comment

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

if this.die is defined/not null? why does this need to be here?

Copy link
Author

Choose a reason for hiding this comment

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

if this.die is defined/not null? why does this need to be here?

My mistake, that's from something unrelated.


update() {
if(this.lifetime<0) this.lifetime = 0;
if(this.damage<0) this.damage = 0;

Choose a reason for hiding this comment

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

For lifetime, I think I'd rather set a min value limit in the html input fields rather than check here. that way it would be obvious to user and not need to be checked every update. this is an issue tho, good catch 👍
idk about damage, why would it ever go below zero?

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.

2 participants