Need help - problem in flipping a block on a plane

Hi, I am a newbie in Blender, and I have to design a game for one of the projects in school.

I’m designing a game which is similiar to this:-

I have got my plane set up already, and I place a block on top of the plane.

The problem I face is:-
I can’t figure out how to do the keystrokes to navigate the block on the plane.
(The keystrokes that I’m trying to do, they are the same in the Bloxorz game that I posted)

The keystrokes:-
Up arrow key - flip it along X axis (to the back), 90 degree
Down arrow key - flip it along X axis (to the front), 90 degree
Left arrow key - flip it along Y axis (to the left), 90 degree
Right arrow key - flip it along Y axis (to the right), 90 degree

The pivot point has to be different in every keystroke right?
I have no idea how can I change the pivot in each keystroke.

Can anyone help?

Thanks a lot! :slight_smile: