====== Gunfight ====== //Gunfight//, a two-player competitive gunslinging game, is one of four built-in programs in the Bally Arcade's system ROM. {{gunfight-play.png}} ===== Gunfight Program Flow Chart ===== The Bally Arcade patent includes an excellent pseudo-code flow chart for //Gunfight//. Though not every game will function the same way, it does lay out a set of best practices for initialization, game states, the game loop, input handling, and interrupts. Get Maximum Score Clear RAM Set vertical blank, horizontal color boundary, interrupt mode Set colors Play Streets of Laredo STRND: Start round Initialize bullets and timers Set up screen Display scores Display "Get Ready" Put up proper number of Cacti, Trees, and Wagon Set up vectors so cowboys walk out Start interrupts Pause until cowboys walk out Erase "Get Ready" LOOP: Call SENTRY (check for a change of input) Call DOIT If bullet hit anything... Kill object If cowboy killed... Set Death Flag Got to LOOP DOIT: If time up for round Exit Go to STRND Else If Death Flag set Exit Go to STRND Else If Player 1 or Player 2 Pot moved Update new arm angle Else If Player 1 or Player 2 Joystick moved Update new velocity Else If key depressed Coffee break Else If Player 1 or Player 2 trigger pulled Fire bullet Else If 1 second has elapsed Update new time ENDIF Exit Interrupt Routine: Bump all time bases Erase all active bullets Vector bullets Write bullets to new location Set each bullets' hit flag if it hit something Erase next object in write queue Vector that object Write that object to a new location Put object back in queue Schedule next interrupt Exit