Is an F-16 able to fire any of its weapons while on the ground? I can recall at least one Hollywood movie, where this takes place (although not an F-16 in the movie).

Is this at all possible? Can the F-16 fire its M61 while taxiing on the ground? What about other weapons?

Note that I'm not even sure myself what good this would do or what the point would be. I'm just curious.

I can imagine the bullets would not even be able to hit a target on the ground, perhaps pass over or below the target. Does the M61 even point perfectly parallel to the ground on an F-16? At least it would change its elevation by some degrees up and down when taxiing, braking, etc. I suppose I could imagine helmet cuing of a low-flying target with an AMRAAM while the aircraft is still trying to take off. Since it has happened before that an airbase is taken by surprise, perhaps this question is not as silly as I at first thought. However, I'm under no illusion that an AMRAAM would be able to engage any target when fired from an aircraft on the ground---doesn't the missile need some time and space to drop from the rail and fire its engine?

I'd love to be told that I'm wrong though.

Nevertheless, I'm curious if the aircraft is designed to prevent firing its weapons while the landing gear is out, or a similar safety feature. If so, can it be overridden? Specifically, what, if anything, prevents an F-16 from firing its M61 while on the ground?

As a bonus question, has this by accident ever occurred, that an aircraft (F-16, or other) fired its weapons while stationary, or taxiing around at an airport?
Yes, the F-16 can fire on the ground, and it has happened as an accident

A maintenance worker accidentally fired a 20mm Vulcan cannon from an F-16 jet he was working on at Belgium's Florennes Air Force Base earlier this week, destroying another F-16 while damaging another aircraft nearby, according to multiple media reports.
A worker apparently opened fire across the flight line while performing maintenance on Oct. 11, according to Avio News. The F-16 that was racked by cannon fire quickly caught fire and exploded, since it was loaded with fuel and being readied for an afternoon sortie, according to Scramble Magazine.

https://taskandpurpose.com/f16-destroyed-belgium