|Object Group||General Actor|
|Actor Group||Group 13|
Bubs are Cheep-Cheep like enemies appearing in Dire, Dire Docks. There are 2 Bubs in Dire, Dire Docks, both located above the whirlpool in the first section. Bubs swim around slowly and do not home in on Mario, but they do deal damage.
Bub has 4 spawner functions, only one of which appears to do anything. First, the game stores a variable equal to an attribute for a value indicating the number of Bubs to spawn. If Mario is within 1500 units of the spawner, the game spawns as many Bubs as the stored value is equal to. Then, the game sets the spawner’s action to 1. When the spawner’s action is 1, the game checks if the difference between Mario and the spawner’s Y-values are greater than 2000. If they are, the game sets the spawner’s action to 2. Then the game sets the spawner’s action to 3, and then sets the spawner’s action to 0.
Bub has three different action functions. The 0th function sets Bub’s first random variable attribute to a random number between 0 and 1 times 100, then sets Bub’s second random variable attribute to a random number between 0 and 1 times 300, then sets Bub’s action to 1. Action 1 checks if the object’s timer is equal to 0. If it is, Bub’s forward velocity is set to 2 plus a random number between 0 and 1 times 2 units/frame, and Bub’s third random variable is set to a random number between 0 and 1. A variable initialized at the start of action 1 is set to Bub’s Y-position minus Mario’s Y-position. If the Bub’s Y-position is less than the water level minus 50 units, the game can do one of two things. If the difference between Mario and Bub’s Y-positions is negative, it is subtracted from 0 to make it positive. If the difference is less than 500 units, Bub’s vertical function is called with a value of 1. Otherwise, Bub’s vertical function is called with a value of 4. If Bub’s Y-position is above the threshold, Bub’s Y-Position is set equal to the threshold and if the distance between Mario’s Y-position and Bub’s Y-position is greater than 300, Bub’s Y-position is lowered by 1 unit. If the lateral distance between Bub’s home and Mario is greater than 800, Bub’s angle toward Mario is set to its angle to its home. Bub rotates towards Mario at 1.4 degrees/frame. If Bub’s distance from Mario is less than 200, and if Bub’s third random variable attribute is less than .5, Bub’s action is set to action 2. If Bub and Mario collide, Bub’s action is set to action 2. In action 2, if Bub’s timer is less than 20, and if Bub is interacted with, white particles are spawned. Otherwise, Bub’s interaction status is reset to 0. If Bub’s timer is equal to 0, a sound is played. If Bub’s forward velocity is 0, Bub’s forward velocity is changed to 6 units/frame. The game then computes the distance between Mario’s Y-position and the object’s Y-position, and runs the same loop as in action 1, with a few differences. If the difference between Mario and Bub’s Y-positions is less than 500, Bub’s vertical function is called with a value of 2 instead of 1, and instead of turning toward Mario at 1.4 degrees/frame, Bub turns toward an angle 180 degrees from Mario at 5.6 degrees/frame. When Bub’s timer reaches 200 and Mario’s distance from Bub is greater than 600, Bub returns to action 1.
Bub’s behavior loop starts by finding the water level and storing a variable equal to the sum of Mario’s Y-position and Bub’s first random variable attribute. Bub’s wall hitbox radius is set to 30 units and the game checks for any collisions. If the spawner is in action 2, Bub is deleted.
Bub’s vertical movement is controlled by a special function which accepts an integer as its input. When the function is called, a variable is set storing the spawner’s Y-position. If the difference of Bub’s Y-position and this variable is greater than -100 and less than 1000 plus two times a random variable generated in Bub’s actions, Bub’s Y-position is incredented towards a new Y-position chosen through the sum of Bub’s second random variable and Mario’s position by the integer the function was called with every frame.