Bub: Difference between revisions

3,034 bytes added ,  19 March 2020
WIP
No edit summary
(WIP)
Line 2: Line 2:
[[Category: Objects]]
[[Category: Objects]]
{{object_infobox_2
{{object_infobox_2
|title=Bub
|title= Bub
|image=STROOP- Bub.png
|image= STROOP- Bub.png
|group=General Actor
|group2 = Group 13
|tangibility=
|draw=
|gravity=
|friction=
|buoyancy=
|interaction= Hurtbox
|damage=1
|health=
|radius=20
|height=10
|hurtbox_radius=20
|hurtbox_height=10
|offset=10
|coins=
}}
}}


Bubs are Cheep-Cheep like enemies appearing in [[DDD]]. There are 2 Bubs in DDD, 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.
Bubs are Cheep-Cheep like enemies appearing in [[DDD]]. There are 2 Bubs in DDD, 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.
==Behavior==
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. Spawner actions 1, 2, and 3 do nothing.
Bub has three different action functions. The 0th function sets one of Bub’s attributes to a random number between 0 and 1 times 100, then sets another attribute to a random number between 0 and 1 times 300, then sets Bub’s action to 1. Action 1 initializes a float, then checks if the object’s timer is equal to 0. If it is, Bub’s forward velocity is set to a random number between 0 and 1 times 2 plus 2 units/frame, and another attribute (Attribute 108) is set to a random number between 0 and 1. The 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 a certain value, the game can do one of two things. If the difference between Mario and Bub’s Y-positions is less than 0, it is set to the negative of its value. If this value 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 the 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 Attribute 108 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. When Bub’s timer reaches 200 and Mario’s distance from Bub is greater than 600, Bub returns to action 1.