07-03-2015, 06:15 PM
there's no pro or con its purely a design choice, they should be functionally exactly the same too, barring ofc the flipped animation, if you're that stuck on them, wipe all you have on them and start from scratch, really it should just be,
Code:
//PSUEDO-CODE
previous_on_ladder = on_ladder
on_ladder = false
if colliding_with_ladder && can_climb_ladder { //if your within the bounds of a ladder and are allowed to climb
on_ladder = true //assume you are on the ladder
}
if on_ladder { //assuming you are on the ladder
if down_key_pressed { //if you are pressing down
climb_down_ladder() //do whatever you want to do when climbing down
player_state = on_ladder //confirm you are on the ladder via your state
}
else if up_key_pressed { //if you are pressing up
climb_up_ladder() //do whatever you want to do when climbing up
player_state = on_ladder //confirm you are on the ladder via your state
}
else if !previous_on_ladder { //if you were not previously on the ladder and are not pressing any ladder buttons
on_ladder = false //then you have not told the character to latch on to the ladder yet, confirm not on the ladder via on_ladder = false
}
}
//stuff handling when your not on a ladder as indicated by on_ladder = false