1 decade ago by drewhjava
I just wanted to say I'm really liking impactjs so far but changing hitboxes based on certain animations has proved to be really frustrating(and frankly I've taken this for granted in other frameworks).
Jumping was not as bad. I had to add a little code to my handleMovementTrace method to subtract the position when the player hit the ground so he wouldn't fall through(being that the jumping animation has a much smaller hitbox then standing.
The crouching has been next to impossible. I'm trying to change the hit box to a much smaller hit box(as I have in the jumping animation). When I hit crouch it changes the animation the hit box. Since the hit box is much smaller the player goes into the falling animation because the velocity is greater than 0(the hit box is off the ground).
I have tried changing offsets(as I did in jumping) adding velocity, position, etc. Nothing I've done get's me where I want to be.
It seems like if I could shrink the hit box from the top instead of the whole thing that would help.
Something like a 4 point size of a hit box. I'm not to sure on the specifics but It seems the hit box should be tied to an animation frame just like a time is tied to an animation(although time should be per frame. it's currently not like that).
If anyone has an suggestions that would be great. Thanks.
Jumping was not as bad. I had to add a little code to my handleMovementTrace method to subtract the position when the player hit the ground so he wouldn't fall through(being that the jumping animation has a much smaller hitbox then standing.
if (this.isJumping && (res.collision.y || res.collision.slope)) { this.isJumping = false; this.vel.y = 0; this.accel.y = 0; this.pos.y = this.pos.y - 20; }
The crouching has been next to impossible. I'm trying to change the hit box to a much smaller hit box(as I have in the jumping animation). When I hit crouch it changes the animation the hit box. Since the hit box is much smaller the player goes into the falling animation because the velocity is greater than 0(the hit box is off the ground).
I have tried changing offsets(as I did in jumping) adding velocity, position, etc. Nothing I've done get's me where I want to be.
It seems like if I could shrink the hit box from the top instead of the whole thing that would help.
Something like a 4 point size of a hit box. I'm not to sure on the specifics but It seems the hit box should be tied to an animation frame just like a time is tied to an animation(although time should be per frame. it's currently not like that).
If anyone has an suggestions that would be great. Thanks.