;=================================================================================== ;======================== ;Function 8 - Buzzbomber= ;======================== @0 # 139 ;FetchObject Current : 6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Buzzbomber moves for a fixed distance before turning around ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 664 ;Increase Obj2 (Increase the movement counter) : E0 ;Move Counter # 361 ;If Not Obj0 Flag (If Buzzbomber is in Moving state) : E1 ;(Obj0) Flags : 1 ;(Flag) Moving/Firing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Flag is off, meaning Buzzbomber is in moving state ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 125 ;If Obj0 < Const (If Buzzbomber hasn't reached the extent of his movement) : E0 ;(Obj0) Move Counter : 128 ;(Const) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Buzzbomber still has more moving distance to cover. While moving, ;he will fire at players if they are within a certain range, and ;if he hasn't done so since the last time he changed direction ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 361 ;If Not Obj0 Flag (If Buzzbomber hasn't fired since he last changed direction) : E1 ;(Obj0) Flags : 0 ;(Flag) Fired Flag ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Buzzbomber has not fired since he last changed direction. check both players to ;determine whether or not either of them are close enough for Buzzbomber to fire ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 137 ;FetchPlayer (Fetch Player 1 for testing) : 6 ;All References : 0 ;Player 1 # 163 ;Reg = Chr0 - Obj0 (Get the horizontal distance between the player and Buzzbomber) : A3 ;(Chr0) Player_X_Pos : 1 ;(Obj0) Object_X_Pos : U7 ;(Dest) Temp (Distance) # 800 ;Abs Reg (Convert the distance is a positive value if it isn't one already) : U7 ;Temp (Distance) # 72 ;if Reg < Const (If the player is no more than 60 units away from Buzzbomber horizontally) : U7 ;(Reg) Temp (Distance) : $60 ;(Const) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Player 1 is within firing range. Jump to the code for causing Buzzbomber to fire ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 847 ;GoTo : @1 # 64 ;EndIf (If the player is no more than 60 units away from Buzzbomber horizontally) # 137 ;FetchPlayer (Fetch Player 2 for testing) : 6 ;All References : 1 ;Player 2 # 101 ;If Chr0 < Const (If player 2 is a valid character) : A0 ;Player_Type : 255 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Player 2 is a valid character type, thus, a player 2 ;exists. Test for him being within firing range ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 163 ;Reg = Chr0 - Obj0 (Get the horizontal distance between the player and Buzzbomber) : A3 ;(Chr0) Player_X_Pos : 1 ;(Obj0) Object_X_Pos : U7 ;(Dest) Temp (Distance) # 800 ;Abs Reg (Convert the distance is a positive value if it isn't one already) : U7 ;Temp (Distance) # 72 ;if Reg < Const (If the player is no more than 60 units away from Buzzbomber horizontally) : U7 ;(Reg) Temp (Distance) : $60 ;(Const) @1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Player 2 is within firing range. Cause Buzzbomber to fire. ;Player 1 also jumps to this code if he is within range ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 144 ;Obj2 = Const (Stop Buzzbomber's horizontal movement) : E2 ;(Dest) X Vel : 0 ;(Src) # 339 ;Stop Object Animation From List (Remove the exhaust flame animation) : 4 ;Flame # 144 ;Obj2 = Const (Reset the movement counter. Buzzbomber's movement range is reset each time he fires) : E0 ;(Dest) Move Counter : 0 ;(Src) # 366 ;Set Obj2 Flag (Set that Buzzbomber has fired since he last changed direction) : E1 ;(Obj2) Flags : 0 ;(Flag) Fired Flag # 366 ;Set Obj2 Flag (Set Buzzbomber to firing state) : E1 ;(Obj2) Flags : 1 ;(Flag) Moving/Firing # 64 ;EndIf (If the player is no more than 60 units away from Buzzbomber horizontally) # 64 ;EndIf (If player 2 is a valid character) # 64 ;EndIf (If Buzzbomber hasn't fired since he last changed direction) # 64 ;EndIf (If Buzzbomber hasn't reached the extent of his movement) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Buzzbomber should only move a distance of 1024 units (128 count * 4 velocity) ;since he last paused to fire or change direction ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 129 ;If Obj0 = Const (If Buzzbomber has moved far enough) : E0 ;(Obj0) Move Counter : 128 ;(Const) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Buzzbomber has reached the extent of his movement. Change his ;direction, and set him to pause briefly before moving again ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 370 ;Flip Obj2 Flag (Reverse Buzzbomber's draw direction) : 6 ;(Obj2) Object_Flags : 0 ;(Flag) Horizontal Flip # 144 ;Obj2 = Const (Stop Buzzbomber's horizontal movement) : E2 ;(Dest) X Vel : 0 ;(Src) # 339 ;Stop Object Animation From List (Remove the exhaust flame animation) : 4 ;Flame # 367 ;Unet Obj2 Flag (Reset fired state; Buzzbomber will be allowed to fire again once he resumes movement) : E1 ;(Obj2) Flags : 0 ;(Flag) Fired Flag # 64 ;EndIf (If Buzzbomber has moved far enough) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Buzzbomber waits 1 second (168 = 128 movement count + 60 frames wait) ;before resuming movement in his new direction ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 129 ;If Obj0 = Const (If the movement delay is over) : E0 ;(Obj0) Move Counter : 168 ;(Const) @2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;The one-second delay after direction change ;has ended. Set Buzzbomber to moveme again. ;Returning to movement mode after having ;fired also jumps to this code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 144 ;Obj2 = Const (Set horizontal velocity [Rightward]) : E2 ;(Dest) X Vel :$400 ;(Src) # 360 ;If Obj0 Flag (If Buzzbomber is facing left) : 6 ;(Obj0) Object_Flags : 0 ;(Flag) Horizontal Flip # 790 ;Negate Obj2 (Change velocity to leftward) : E2 ;X Vel # 64 ;EndIf (If Buzzbomber is facing left) # 144 ;Obj2 = Const (Reset the movement counter; Buzzbomber is allowed to travel another 1024 units) : E0 ;(Dest) Move Counter : 0 ;(Src) # 337 ;Set Object Animation From List (Set body animation for moving, not firing) : 0 ;Normal # 338 ;Add Object Animation From List (Set wing animation for moving, not firing) : 2 ;Wings Firing # 338 ;Add Object Animation From List (Add the exhaust flame) : 4 ;Flame # 64 ;EndIf (If the movement delay is over) # 63 ;Else (If Buzzbomber is in Firing state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Flag is on, meaning Buzzbomber is in firing state. ;He should pause for half a second before firing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 129 ;If Obj0 = Const (If the firing delay is over) : E0 ;(Obj0) Move Timer : 30 ;(Const) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Firing delay is over, set Buzzbomber's animations for firing. ;The body animation is responsible for spawning the projectile ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 337 ;Set Object Animation From List (Set body animation for firing, not moving) : 1 ;Firing # 338 ;Add Object Animation From List (Set wings animation for firing, not moving) : 3 ;Wings Firing # 64 ;EndIf (If the firing delay is over) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;After having fired, wait one second before returning to ;normal movement (90 = 30 firing delay + 60 fired delay) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 129 ;If Obj0 = Const (If the fired delay is over) : E0 ;(Obj0) Move Timer : 90 ;(Const) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;One second has passed since Buzzbomber had ;fired. Set him back to normal movement state ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 367 ;Unset Obj2 Flag (Set Buzzbomber to moving state) : E1 ;(Obj2) Flags : 1 ;(Flag) Moving/Firing # 847 ;GoTo (Jump to the code that sets Buzzbomber to move after having changed directions) : @2 # 64 ;EndIf (If the fired delay is over) # 64 ;EndIf (If Buzzbomber is in Moving or Firing state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Repeat this movement sentry on the next frame ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; # 28 ;Loop : @0 ;Label 0 : 0 ;Counter : -1 ;Repeat Forever # End ;Terminate Function