0
다음에 처음 작동하지 않습니다. 이것은 처음 트리거 될 때 매력처럼 작동합니다. 하지만 그 후에는 플레이어 YPos가 8 번 증가하여 트리거됩니다. 내가 생각할 수있는 모든 것을 시도했지만 그 이유를 파악하지 못했습니다.Javascript/HTML5 Game dev - 간단한 점프 구현.
var playerYPos = 188;
var playerJumpSpeed = 8;
var playerJumpVelocity = playerJumpSpeed;
function jump(){
playerYPos -= playerJumpVelocity;
//Hits top
if(playerYPos < 40){
playerJumpVelocity = -playerJumpSpeed;
}
if(playerYPos >= 188){
keyW = false;
}
}
도움을 주시면 감사하겠습니다.
나머지 코드는 어디에 있습니까? 어떻게 뛰어 내리고 있니? – YoannM