if(jumping==true)
{
jspeed += gravity;
tempsddist=Math.abs(jumpspeed-jspeed);
if((this.y+jspeed)<(sd.y-sddist))
{
this.y+=jspeed;
}
else if(jspeed>0 && (this.y+jspeed)>=(sd.y-sddist))
{
trace("HERE:"+(tempsddist+gravity));
jumping = false;
jspeed=0;
this.y=sd.y-sddist;
tempsddist=sddist;
}
}
if(key[global.plkjump]==true && jumping==false)
{
jumping=true;
if(this.currentLabel!="jump")
{
this.gotoAndStop("jump");
}
jspeed = jumpspeed;
}
if(key[37]==true && key[39]!=true)//left
{
if((this.currentLabel!="run" || this.scaleX==1) && jumping==false)
{
this.gotoAndStop("run");
this.scaleX=-1;
}
if((this.x-run_sp)<global.scrolldist && global.plpos>=global.scrolldist)
{
scrl(run_sp,run_sp/2,run_sp/4);
global.plpos-=run_sp;
}
else if(global.plpos>=0)
{
this.x=(global.plpos-run_sp)>=0?this.x-run_sp:this.x-=(global.plpos);
global.plpos-=run_sp;
}
}
if(key[39]==true && key[37]!=true)//right
{
if((this.currentLabel!="run" || this.scaleX==-1) && jumping==false)
{
this.gotoAndStop("run");
this.scaleX=1;
}
if((this.x+run_sp)>(global.gamewid-global.scrolldist) && global.plpos<=(global.lvlmaxScroll-global.scrolldist))
{
scrl(-run_sp,-run_sp/2,-run_sp/4);
global.plpos+=run_sp;
}
else if(global.plpos<=global.lvlmaxScroll)
{
this.x=(global.plpos+run_sp)<=global.lvlmaxScroll?this.x+run_sp:this.x+=(global.lvlmaxScroll-global.plpos);
global.plpos+=run_sp;
}
}
if(key[38]==true && key[40]!=true) //up
{
if(this.currentLabel!="run" && jumping==false)
{
this.gotoAndStop("run");
}
if((sd.y-run_sp)>259)
{
this.y-=run_sp;
sd.y-=run_sp;
}
else
{
sd.y=259;
}
}
if(key[40]==true && key[38]!=true) //down
{
if(this.currentLabel!="run" && jumping==false)
{
this.gotoAndStop("run");
}
if((sd.y+run_sp)<398)
{
this.y+=run_sp;
sd.y+=run_sp;
}
else
{
sd.y=398;
}
}
else if(key[37]==key[39]&&key[38]==key[40] && jumping==false)
{
this.gotoAndStop("stand");
}
For some weird reason, with the above code, i can’t jump when i press any two arrow keys…any ideas?