PGPlayer.prototype.Update = function(){
this.sprPlayer.Update();
if(this.isJumping == false){
if(inputSystem.isKeyDown(32)){
this.isJumping=true;
this.jumpPower=-20;
// 이미ㅣㅈ 변경
this.sprPlayer.img = resourcePreLoader.GetImage("img/game_player_jump.png");
this.sprPlayer.width =156;
this.sprPlayer.height =222;
this.sprPlayer.totalFrameCount =1;
this.sprPlayer.fps =10;
}
}
else{
this.y+=this.jumpPower;
this.jumpPower+=1.5;
if(this.y>=255){
this.y=255;
this.isJumping=false;
this.sprPlayer = new SpriteAnimation(
resourcePreLoader.GetImage("img/game_player.png"),
156,222,4,8);
this.jumpgo=0;
}
this.Invalid();
}
}
대충 이 소스 내용이 점프중이 false일 때 32번키(스페이스)를 입력하면 캐릭터의 y값이 바뀌면서
위로 올라갔다가 y값에 1.5씩 계속 더해서 아래로 내려오는 방식이거든
근데 2단점프를 구현하고 싶은데 안되네
변수 2개넣어도 스페이스 누르고 잇다보니 바로 2단점프되고..
어떤 방식으로 해야될지 모르겟어 0.5초정도 대기햇다 실행하면 좋을텐데
도중에 끊는 방법도 모르겟고..
http://lgstar.tk
커뮤니티 사이트 입니다 많은 이용 부탁 드립니다. - DCW