Check out my answer: Platformer collision problems (C++)
Maybe it doesn't seem so simple to implement with your codes but that collision system would be the best choice for you (I think).
Check out my answer: Platformer collision problems (C++)
Maybe it doesn't seem so simple to implement with your codes but that collision system would be the best choice for you (I think).