Grindel
Grindel is an enemy appearing inside the Pyramid in Shifting Sand Land. It has two varieties: a vertically moving one which is identical to Thwomp in behavior and a horizontally moving one which jumps back and forth over a distance.
Grindel | |
Technical Constants | |
Object Group | Surface |
Actor Group | N/A |
Draw Distance | 4000 |
Physical Constants | |
Gravity | -400 |
Friction | 1000 |
Buoyancy | 200 |
Behavior
The vertically moving Grindel shares the same behavior as the Thwomp, moving up, staying in the air, moving down again and repeating. The horizontally moving Grindel uses different behavior. It moves forward as well as upward and turns around after jumping several times. This is done using the following procedure.
The horizontal Grindel is initialized with its target yaw set to its moving angle yaw. If Grindel is not in the air, and Grindel’s attributes have not already been updated to reflect that it is on the ground, then code is run to reflect that Grindel has just landed. In this code, a sound effect plays, Grindel’s attributes are updated to reflect that it is on the ground, the camera shakes, Grindel’s distance to its home is updated, and its forward velocity and timer are set to equal 0. If Grindel’s target yaw is not equal to its current yaw, Grindel will rotate at 5.625 degrees per frame until it reaches its target yaw. During this process, Grindel’s timer attribute is set to 0 continuously. This is what is run to turn Grindel around over the course of 32 frames. 60 frames after the target yaw has been reached, if Grindel is more than 300 units from its home, Grindel’s target yaw is increased by 180 degrees, and Grindel’s distance to its home is set to 0, changing its home to its current position and causing it to begin turning toward its target yaw again. If Grindel is not more than 300 units from its home, Grindel’s jumping action begins. In this action, a sound effect is played, Grindel’s forward velocity is set to 11 units/frame, Gindel’s Y-velocity is set to 70 units/frame, Grindel’s gravity is set to -4, and Grindel’s move flags attribute is set to 0. When Grindel is in the air, Grindel’s attributes are updated to reflect that it has left the ground, and if Grindel’s Y-velocity is less than 0, its gravity is set to -16. Overall, it takes 28 frames for Grindel to complete a full jump, its jump peaks at 648 units off the ground, and it moves forward a total of 308 units.