I am working on a bit of a platformer game. I have a variable called jumpSpeed, and it defines how high the player can jump. I also added a variable (jumpheight) that notices when the player presses the up arrow key, and displays it on the html page in a div tag. As I was bug testing, I noticed the player could hold down the up arrow and still have jumpSpeed increase, but the jumpheight variable would not notice it. Does anyone have any ideas on how to make the JS notice the jumpSpeed value increase, and then change the jumpheight variable in the div tag. Thanks.
Javascript:
var jumpheight = 0;
var jumpSpeed = 17;
function disp(str){
document.getElementById('my_msg').innerHTML=str;
}
document.onkeyup = function() {
switch (window.event.keyCode) {
case 38:
jumpheight++;
disp(jumpheight)
}};
Html:
<div style="display: inline-block;">Jump Count: </div>
<div style="display: inline-block;" id=my_msg></div>