Sure! Here's an example implementation of the game you described:
This code creates a canvas element where the game is rendered. The gun is controlled by touch or keyboard input, and it automatically shoots bullets. Green cubes fall from the sky, and the player needs to shoot them by touching the gun or pressing trigger keys. The score is displayed, and the game ends when the player reaches a score of 30.
Please note that this is a simple implementation and there is room for improvements and optimizations.