Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by mega

I'm new impactjs and I searched the threads but couldn't find a solution to this problem, so I apologize if this question has been addressed. I'm using the mover.js entity from the biolab entity pack and it works fine except when the player jumps on top of a platform he remains in the 'jump' position and appears jittery. Does anyone know how to correct this? thx.

1 decade ago by ansimuz

Put a flag variable on the player to check if it is jumping or standing on the mover. and in the mover check if the player is on it:

// on the mover
collideWith: function(other,axis){
            // tell player is on a platform
            if(other instanceof EntityPlayer
                && axis == 'y'){
                other.onMover = true;
            }
        },


On the player

if(this.vel.y > 0 && !this.onMover  ){
                        this.currentAnim = this.anims.fall;
                        if(this.animationFlag){
                            
                             
                        }

You will have to reset this variable on the update() for the player to false to reset it
Page 1 of 1
« first « previous next › last »