180 degree inversion of the character

You have to write a special character:

I am new when it comes to creating games in eu4 and I would like to make a game in which after clicking a button the character turns its rotation by 180, that is: the character stands on the ground and after clicking a button it turns upside down and stands on the ceiling

Something like this

but what if I do it on a 2d side scroller