Okay, here's how to do it using Tasker:
Install Tasker
Create a new Task called lock screen, add an action to it as via
Display → System Lock
Create a profile and add as context to it all games in the apps list it provides, or as you need it.
Link the lock screen task to this profile.
Your device should lock up now if you try to open any marked app.
Note: Tasker is a paid app. Also, the trigger system lock functionality needs you to allow Tasker as a device administrator.
Edit:
I figured out how to do this using MacroDroid, which is free for a limited feature set.
Install MacroDroid and open it.
Tap on create new macro
Select Application launched/closed from the trigger list.
Select application launched from the popup
Choose the required apps from the list.
Choose the action as screen on/off.
Choose screen off from the popup
Press the tick button.
On the constraints page, leave it at none and press the tick button.
Enter a relevant name for the macro and press OK in the resulting popup.
This worked for me. Again, this needs the app to be a device administrator, which will be indicated to you as you select the screen off action, for similar reasons as above.