This is what loops are for.
You'll still need an object to collide with the wall, but you'll simply make it invisible. You'll spawn a bullet object at the end of the gun object, and run a loop that iterates the bullet's position across space until it finds a collision. Loops run within a step instead of once every step, so it will not continue any other code until that loop is done, and the iteration ensures contact, so the bullet movement is instantaneous without concern of it overlapping too far or phasing through other objects.
Basically, you would use a while loop condition. The loop is run while the bullet is not overlapping anything. The actions in the loop should move the bullet forward one or more pixels ahead (the farther this distance, the less iterations the loop will have to run as the bullet will make contact that much faster, so keep that in mind). In an else condition, add a break loop action, destroy the bullet and create the spark effect.
Be mindful of while loops, as they will run forever until a condition is satisfied. Make sure your environment is air tight, or create an escape condition such as breaking the loop or destroying the bullet after it has traveled a certain distance.