DavideMiccolis
Member
in my Idle state:
Code:
if (ground && keyjump)
{
vsp=-vspmax;
state=states.jump;
}
Code:
sprite_index=spr_player_jump;
if (!ground && vsp>0)
{ state=states.falling; }
//move air dx sx
if (!ground && move!=0)
{
image_xscale=move;
if (move==1)
{ hsp=scr_approach(hsp*0.85,hspmax*move,airacceleration); }
if (move==-1)
{ hsp=scr_approach(hsp*0.85,hspmax*move,airacceleration); }
}
// little jump
if (keyjumprelease)
{
if (vsp<0)
{
vsp *=0.5;
}
}
//double jump
if (keyjump && !ground && djump>0)
{
vsp=-vspmax*percentualedoppiosalto;
djump--;}
Code:
sprite_index=spr_player_falling;
if (ground)
{
//double jump reset
if (djump==0)
{ djump++; }
state=states.idle;
}
if (!ground && move!=0)
{
image_xscale=move;
if (move==1)
{ hsp=scr_approach(hsp*0.85,hspmax*move,airacceleration); }
if (move==-1)
{ hsp=scr_approach(hsp*0.85,hspmax*move,airacceleration); }
}