Tox Box

The Tox Box is an enemy in Shifting Sand Land. The enemy moves in a set pattern and will crush Mario is he is caught below it.

Tox Box
STROOP- Tox Box.png
Technical Constants
Object Group Surface
Actor Group N/A
Draw Distance 8000

Behavior

Movement Function

The Tox Box movement function takes 4 parameters; 2 floats (a0 and a1) and 2 shorts (a2 and a3). The Y-position of Tox Box is given as:

 

Its forward velocity is set to a0 and its z-velocity is set to a1. Its pitch facing angle is increased by a2 whenever the function runs. If this angle is less than 0, a3 is set to negative a3 and its roll facing angle is increased by a3 whenever the function runs. After 8 frames, the Tox Box moves into another action and plays a sound.

Actions

Tox Box has 1 initialization action and 7 actions used to control its movement. When Tox Box is initialized the game checks which parameter it has to assign its movement pattern. Action 1 sets the forward velocity to 0, shakes the screen for one frame if Mario is close enough and increases its Y-value by 3. After 21 frames, the next action occurs. Actions 2 and 3 simply keep the Tox Box in its current position for 21 frames. Action 4 runs the movement function with the parameters (64,0,0x800,0). Action 5 runs the movement function with the parameters (-64,0,-0x800,0). Action 6 runs the movement function with the parameters (0,-64,0,0x800). Action 7 runs the movement function with the parameters (0,64,0,-0x800).

Movement Patterns

There are three movement patterns used for Tox Box. Each consists of a list of numbers corresponding to one of the 7 movement actions. Every other action in the list is action 1, which halts the Tox Box for 21 frames, and each ends with -1, looping to the start of the list. Action 2 is used to freeze the Tox Box for an additional 20 frames before it reverses direction and Action 3 is never used. The Tox Box takes 8 frames to make a full movement, during which it moves 11.25 degrees per frame and 64 units/frame in the direction it is moving in.

Pattern 1: { 4, 1, 4, 1, 6, 1, 6, 1, 5, 1, 5, 1, 6, 1, 6, 1, 5, 1, 2, 4, 1, 4, 1, 4, 1, 2, 5, 1, 5, 1, 7, 1, 7, 1, 4, 1, 4, 1, 7, 1, 7, 1, 5, 1, 5, 1, 5, 1, 2, 4, 1, -1 }

Pattern 2: { 4, 1, 4, 1, 7, 1, 7, 1, 7, 1, 2, 6, 1, 6, 1, 6, 1, 5, 1, 5, 1, 6, 1, 5, 1, 5, 1, 2, 4, 1, 4, 1, 7, 1, -1 }

Pattern 3: { 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 2, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 7, 1, 2, 6, 1, 6, 1, 5, 1, 2, 4, 1, 7, 1, -1 }

References