Sure, here's an example of a simple sandbox game with portal gun features using JavaScript and HTML:
This code sets up a canvas element that acts as the game world. The player can use the WASD keys to move around, and spacebar to place portals. The player character is represented by a blue square, and the portals are represented by orange squares.
You can open this code in a web browser to play the game. The canvas will resize automatically to fit the browser window, making it suitable for smartphone operation.