Same diametric move intensity on different resolutions in Matter.js
up vote
-2
down vote
favorite
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. Even worst if canvas size become bigger player have smallest jump , for smaller window player jumps higher! I dont want to callibrate in hard code way. I need responsive function!
"leave a comment before vote negative"
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;
}
};
Full source : link
javascript typescript3.0 matterjs
add a comment |
up vote
-2
down vote
favorite
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. Even worst if canvas size become bigger player have smallest jump , for smaller window player jumps higher! I dont want to callibrate in hard code way. I need responsive function!
"leave a comment before vote negative"
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;
}
};
Full source : link
javascript typescript3.0 matterjs
Please leave comment whats wrong with this Q ?!
– Nikola Lukic
yesterday
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
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. Even worst if canvas size become bigger player have smallest jump , for smaller window player jumps higher! I dont want to callibrate in hard code way. I need responsive function!
"leave a comment before vote negative"
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;
}
};
Full source : link
javascript typescript3.0 matterjs
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. Even worst if canvas size become bigger player have smallest jump , for smaller window player jumps higher! I dont want to callibrate in hard code way. I need responsive function!
"leave a comment before vote negative"
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;
}
};
Full source : link
javascript typescript3.0 matterjs
javascript typescript3.0 matterjs
edited 2 days ago
wanttobeprofessional
81331222
81331222
asked Nov 18 at 20:02
Nikola Lukic
1,67821735
1,67821735
Please leave comment whats wrong with this Q ?!
– Nikola Lukic
yesterday
add a comment |
Please leave comment whats wrong with this Q ?!
– Nikola Lukic
yesterday
Please leave comment whats wrong with this Q ?!
– Nikola Lukic
yesterday
Please leave comment whats wrong with this Q ?!
– Nikola Lukic
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364905%2fsame-diametric-move-intensity-on-different-resolutions-in-matter-js%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please leave comment whats wrong with this Q ?!
– Nikola Lukic
yesterday