diff --git a/fcore/player/player.sml b/fcore/player/player.sml index f0249f1..bd4c69e 100644 --- a/fcore/player/player.sml +++ b/fcore/player/player.sml @@ -50,11 +50,11 @@ struct if jumpPressed then (* apply gravity *) FALLING else JUMPING 0 | _ => prevAxis - fun getJumpPatches (player, upHeld, downHeld, acc) = + fun getJumpPatches (player, jumpHeld, downHeld, acc) = let val {yAxis, jumpPressed, ...} = player in - case (upHeld, downHeld) of + case (jumpHeld, downHeld) of (false, false) => let val yAxis = defaultYAxis yAxis @@ -205,7 +205,7 @@ struct , ... } = player - val {leftHeld, rightHeld, upHeld, downHeld, attackHeld} = input + val {leftHeld, rightHeld, upHeld, downHeld, attackHeld, jumpHeld} = input val xAxis = getXAxis (leftHeld, rightHeld) val facing = getFacing (facing, xAxis) @@ -225,7 +225,7 @@ struct , mainAttackPressed ) - val acc = getJumpPatches (player, upHeld, downHeld, acc) + val acc = getJumpPatches (player, jumpHeld, downHeld, acc) in acc end diff --git a/shell/input-state.sml b/shell/input-state.sml index 88551f5..8cff41f 100644 --- a/shell/input-state.sml +++ b/shell/input-state.sml @@ -15,6 +15,7 @@ struct , rightHeld = ref false , upHeld = ref false , downHeld = ref false + , jumpHeld = ref false , attackHeld = ref false , width = ref (1920.0 : Real32.real) , height = ref (1080.0 : Real32.real) @@ -26,6 +27,7 @@ struct , upHeld = !(#upHeld state) , downHeld = !(#downHeld state) , attackHeld = !(#attackHeld state) + , jumpHeld = !(#jumpHeld state) } fun actionToBool action = action = Input.PRESS @@ -42,7 +44,7 @@ struct else if code = right then #rightHeld state := action else if code = down then #downHeld state := action else if code = attack then #attackHeld state := action - else if code = jump then #upHeld state := action + else if code = jump then #jumpHeld state := action else () end | NONE => ()