Hammer I/O for Morph Ball Madness
Morph Ball Madness required a major overhaul of the controls in Half-Life 2. This game_ui detects various inputs from the player and fires relays that correspond to the numerous events that the different inputs require.
|
The player has two different types of bombs in Morph Ball Madness. The primary fire (left click) drops a bomb that detonates immediately, while the alternate fire (right click) drops a bomb on a 1 second timer.
The player moves in a separate plane from the visual portion of the level, consisting of invisible clip brushes. Since the player's collision is taller than the spherical remote, this allows the player to move through the level without getting stuck on small passages. However, this means that the player can't use grenades normally in order to drop a bomb, since they would not spawn in the correct location. Instead, these relays spawn npc_grenade_frags from templates. Since grenades spawned from templates (instead of thrown as normal weapons) are not "live", these relays set their timers immediately after spawning them in order to activate them. The relays also disable themselves, while enabling countdown timers, in order to throttle the rate at which the player can drop bombs. |
UI/Controls: Movement
Movement in Morph Ball Madness includes rotating the remote in the correct direction, jumping, using magnetic rails (ladders), and boosting off the magnetic rails.
The spherical remote prop_dynamic is parented to a func_rotating that allows it to spin. The game_ui detects what direction the player is moving, and tells the func_rotating to rotate either forwards or backwards, depending on whether the remote is going to the right or the left.
A set of trigger_pushes enable boosting off of magnetic rails (ladders), since the player cannot normally jump off of ladders in Half-Life 2. These triggers are parented to the player, so that they can be activated no matter where the player is.
Since the game_ui does not detect the spacebar, the configuration files included with the level remap the spacebar to fire a relay that controls the jumping/boosting functionality. When the player jumps, several logical tests are run:
The combination of a 2D camera and ladders presents an additional problem. In order for the player to descend a ladder in Half-Life 2, they must look down. Since the player cannot pan the camera in Morph Ball Madness, they cannot look down. Thus, all movement directions, including down (back), are interpreted as moving UP the ladder.
To solve this, when the player presses down, a trigger_push is briefly enabled that pushes the player down. This is why the remote 'hops' off of a ladder when the player presses down: the player briefly climbs the ladder before the trigger pushes them downward, knocking them off the ladder.
The spherical remote prop_dynamic is parented to a func_rotating that allows it to spin. The game_ui detects what direction the player is moving, and tells the func_rotating to rotate either forwards or backwards, depending on whether the remote is going to the right or the left.
A set of trigger_pushes enable boosting off of magnetic rails (ladders), since the player cannot normally jump off of ladders in Half-Life 2. These triggers are parented to the player, so that they can be activated no matter where the player is.
Since the game_ui does not detect the spacebar, the configuration files included with the level remap the spacebar to fire a relay that controls the jumping/boosting functionality. When the player jumps, several logical tests are run:
- If the player is on a ladder, and is pushing left or right, the corresponding directional trigger_push is briefly enabled
- If the player is on a ladder, and is not pushing to the left or right, the vertical trigger_push is briefly enabled
- If the player is not on a ladder, the "+jump" console command is fired, causing the player to jump normally
The combination of a 2D camera and ladders presents an additional problem. In order for the player to descend a ladder in Half-Life 2, they must look down. Since the player cannot pan the camera in Morph Ball Madness, they cannot look down. Thus, all movement directions, including down (back), are interpreted as moving UP the ladder.
To solve this, when the player presses down, a trigger_push is briefly enabled that pushes the player down. This is why the remote 'hops' off of a ladder when the player presses down: the player briefly climbs the ladder before the trigger pushes them downward, knocking them off the ladder.
Video clip showing the movement mechanics in Morph Ball Madness, including rotation, jumping, attaching to rails, and boosting off rails
|
|