I need help. I have a player and i want jump player always in same diametric order. I wanted to fix this with getHeight with return ( innerHeight/100 * per ) but no improved. Event wrost if i canvas comes to be bigger player have smallest jump , for smaller window player jumps higher! I dont want to callibrate in hard code way . I need function !
r.player.force = { x: 0, y: -(getHeight(0.03)), }; Matter.Body.applyForce(r.player, { x: r.player.position.x, y: r.player.position.y }, r.player.force); public getHeight(percente: number): number { return this.reperH() / 100 * percente; } this.reperH = function () { if ((window as any).innerHeight > (window as any).innerWidth / this.aspectRatio) { return (window as any).innerWidth / this.aspectRatio; } else { return (window as any).innerHeight; } };