Adobe After Effects is a professional motion desgiern tool, not a game creator. While you can use code, AE has a massive limitation as each frame runs the code anew. There is no frame-to-frame memory.
Yet (at least) two creators managed to create playable video games inside After Effects. In this video, I tracked down three legendary AE games. Chris Zwar's 2004 artillery game "Tanx AE" and Hallam Roberts Pong and Super Mario Bros.
At first glance, making a video game in After Effects looks like just a fun diversion, but when you explore the projects, you'll find they are goldmines of clever code you can use in your own projects.