VersusMatch
A fighting game’s match between two fighters, with no code: rounds (best of three to start with) against a clock, each starting with “Round 1” and “Fight!” and ended by a knockout (a fighter’s Health running out) or by the time running out (more health left wins), the fighters back in their places at full health for the next; and once a fighter has won enough rounds, “Kenta Wins” and its WinMessage, which opens a panel with a rematch. With no rounds to win it’s a training session: no clock, and a fighter knocked out gets up again.
Part of the Fighting module: Fighting games: Hitboxes, hitboxes and hurtboxes for each frame of an animation’s clips (drawn in the Clip Editor), that land hits with damage, knockback and hitstun; fighters (FightingCharacter) that walk, jump, crouch, block and do moves written in numpad notation (quarter circles, dragon punches, charges) with an input buffer, cancels and combos; a computer to fight (ComputerFighter); a CharacterSelect where players at one machine each pick their fighter, and a VersusMatch of rounds against the clock; a sparring pair and a training pair to make from the Entity menu (Genres, Fighting); and the Fighter template, a whole versus fighting game.
It puts in the fighters picked on a CharacterSelect (their prefabs, kept in the save data under Picks) in place of the two in the scene as it starts, keeping their names, places and PlayedBy, and gives the second to the computer (ComputerFighter) when one player plays alone. Its outputs (the round, the time left, each side’s rounds won and name, what’s announced, the winner) are for a HUD’s texts, bars and stars; its phase, clock and wins are kept with the scene, so a rewind carries on mid-round.
Works with: CharacterSelect (puts in the fighters picked on one); FightingCharacter (the two fighters, by name)
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
first: text = “Player 1”. The first player’s fighter, by name: on the left as a round starts. (Names an entity.) (Field: an entity’s name.)second: text = “Player 2”. The second player’s fighter, by name: on the right as a round starts. (Names an entity.) (Field: an entity’s name.)roundsToWin: a whole number = 2. Rounds a fighter must win to win the match: 2 is best of three. 0 for a training session with no rounds or clock. (Field: a number.)roundTime: a number = 60. Seconds a round lasts before the time’s up (and more health left wins it). 0 for no clock. (Field: a number.)introTime: a number = 1.4. Seconds “Round 1” is shown before the fighters can move. (Field: a number.)roundOverTime: a number = 2.5. Seconds after a K.O. (or the time running out) before the next round, or the winner. (Field: a number.)koFreeze: a number = 0.5. Seconds the game freezes on a K.O., for it to land hard. (Field: a number.)
Fighters Picked
Section titled “Fighters Picked”picks: text = “Pick”. A name in the save data the fighters picked are kept under (as a CharacterSelect’s Save As keeps them), e.g. “Pick”: “Pick.1” and “Pick.2” hold the prefabs to put in place of the first and second fighters as the match starts, and “Pick.Computer” says the computer plays the second. Empty fights the two in the scene. (Names a name in the save data.) (Field: a name.)computer: true or false = false. The computer plays the second fighter (as it does when the picks say so): a ComputerFighter is given to it. (Field: on or off.)computerBehavior: one of Fight, Stand, Crouch, Jump = “Fight”. What the computer’s fighter does: fight, or stand, crouch or jump as a training dummy. (Field: one of its values.)computerDifficulty: one of Easy, Normal, Hard = “Normal”. How well the computer fights. (Field: one of its values.)secondTint: a color, “#RRGGBB” or “#RRGGBBAA” = “#A8C8FFFF”. A tint for the second fighter when both picked the same one, so they can be told apart. (Field: a color.)
Sounds and Messages
Section titled “Sounds and Messages”roundSound: text = null. A sound played as each round is announced. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)fightSound: text = null. A sound played as “Fight!” is. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)koSound: text = null. A sound played on a K.O. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)winSound: text = null. A sound played as the match is won. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)roundMessage: text = “Round”. A message sent as each round starts, with its number as its data. (Names a message.) (Field: a name.)roundOverMessage: text = “Round Over”. A message sent as a round is won, with the winner’s name as its data (“Draw” for neither). (Names a message.) (Field: a name.)winMessage: text = “Match Over”. A message sent as the match is won, with the winner’s name as its data: a panel opens on it. (Names a message.) (Field: a name.)
phase: one of Starting, Intro, Fighting, RoundOver, Over = “Starting”. Where the match has got to. Set by the game. (Field: one of its values.)round: a whole number = 0. The round being fought, from 1. Set by the game. (Field: a number.)firstWins: a whole number = 0. Rounds the first fighter has won. Set by the game. (Field: a number.)secondWins: a whole number = 0. Rounds the second fighter has won. Set by the game. (Field: a number.)clock: a number = 0. Seconds left on the round’s clock. Set by the game. (Field: a number.)timer: a number = 0. Seconds until it moves on from the intro or a round’s end, or stops showing “Fight!”. Set by the game. (Field: a number.)announcement: text = null. What’s announced in the middle of the screen: “Round 1”, “Fight!”, “K.O.”, “Time”, “Kenta Wins”; empty for nothing. Set by the game. (Plain text: what’s announced: the game sets it.) (Field: text.)winner: text = null. The fighter that won the match (its name, as shown), or “Draw”; empty until it’s over. Set by the game. (Plain text: who won: the game sets it.) (Field: text.)firstName: text = null. The first fighter’s name as shown: its character’s (the prefab it was made from), or its own. Set by the game. (Plain text: the fighter’s name as shown: the game sets it.) (Field: text.)secondName: text = null. The second fighter’s name as shown. Set by the game. (Plain text: the fighter’s name as shown: the game sets it.) (Field: text.)firstStart: [x, y] = [0,0]. Where the first fighter starts each round, as it was placed. Set by the game as the match starts. (Field: a vector.)secondStart: [x, y] = [0,0]. Where the second fighter starts each round. Set by the game as the match starts. (Field: a vector.)
Actions
Section titled “Actions”What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).
Rematch. Starts the match over from round 1: no rounds won, the fighters back in their places at full health.ResetPositions. Puts the fighters back in their places at full health, the round going on (training’s Reset).ToggleHitboxes. Shows the hitboxes over the game, or stops (training).
Outputs
Section titled “Outputs”What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.
Round(a whole number). The round being fought, from 1. Set by the game.FirstWins(a whole number, out of its roundsToWin). Rounds the first fighter has won. Set by the game.SecondWins(a whole number, out of its roundsToWin). Rounds the second fighter has won. Set by the game.Announcement(a name). What’s announced in the middle of the screen: “Round 1”, “Fight!”, “K.O.”, “Time”, “Kenta Wins”; empty for nothing. Set by the game.Winner(a name). The fighter that won the match (its name, as shown), or “Draw”; empty until it’s over. Set by the game.FirstName(a name). The first fighter’s name as shown: its character’s (the prefab it was made from), or its own. Set by the game.SecondName(a name). The second fighter’s name as shown. Set by the game.TimeLeft(a whole number). The seconds left on the clock, as a whole number counting down (99, 98…), for a HUD.Over(true or false). True once the match is won.Fighting(true or false). True while the fighters can fight: the round under way.Hitboxes(a name). “On” while the hitboxes are drawn over the game (its Toggle Hitboxes action), “Off” otherwise: a training menu’s label.
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
timeLeft: a whole number. The seconds left on the clock, as a whole number counting down (99, 98…), for a HUD.over: true or false. True once the match is won.fighting: true or false. True while the fighters can fight: the round under way.hitboxesShown: text. “On” while the hitboxes are drawn over the game (its Toggle Hitboxes action), “Off” otherwise: a training menu’s label.
Scripts use it as VersusMatch: its methods, events and values that aren’t saved with the scene.