CharacterSelect
A fighting game’s character select, with no code: each player at this machine moves their own cursor over the characters’ cards (the entity’s children, in order, one for each of its Characters) with their own keys or controller and picks one with a button; once everyone has, the picks are kept in the save data and Scene loads, where a VersusMatch puts them in. With one player and Computer, the computer takes the character after the player’s. A click (or a tap) on a card picks it for the first player still choosing.
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.
Each player’s cursor is an entity it moves over the card picked (FirstCursor, SecondCursor), and a preview of what each has on (FirstPreview, SecondPreview) takes the character’s picture and clips. The players’ controls are shared out as Game.LocalPlayers says (two at one keyboard, two controllers, or one of each); its Swap Controls action swaps the first two’s.
Works with: VersusMatch (the match its picks are fought in (in its Scene))
Takes the player’s input only while it has focus (its Controllable): its Focus action hands it the input and takes it from everything else the same player plays.
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.
characters: text = null. The characters to pick from, by their fighters’ prefabs, separated by commas, in the order of its cards: “Kenta, Mira”. (Names prefabs: their names, separated by commas.) (Field: a name.)players: a whole number = 2. How many people pick: 2 for versus, 1 against the computer or to train. (Field: a number.)computer: true or false = false. With one player: the computer takes the second fighter (the character after the player’s), and the match gives it to the computer. (Field: on or off.)scene: text = null. The scene to load once everyone has picked, e.g. “Stage”. (Names a scene.) (Field: a name.)saveAs: text = “Pick”. A name to keep the picks under in the save data, e.g. “Pick”: “Pick.1” and “Pick.2” (the characters), “Pick.Computer” (whether the computer plays the second), and “Pick.Scene” (this scene, for a “Character Select” button to come back to). (Names a name in the save data: this entity’s own, which other fields can name.) (Field: a name.)columns: a whole number = 0. How many cards to a row: the cursors move across and down them. 0 puts them all in one row. (Field: a number.)delay: a number = 0.8. Seconds after the last pick before the scene loads, to see who’s fighting whom. (Field: a number.)
Controls
Section titled “Controls”pickActions: text = “Punch, Kick, Interact”. The input actions that pick, separated by commas. (Names input actions: their names, separated by commas.) (Field: a name.)backAction: text = “Dash”. The input action that takes a pick back. (Names an input action.) (Field: a name.)controllable: true or false = true. Untick it to ignore the players’ controls and clicks (its Pick action still picks). Its Focus action ticks it and unticks it on everything else the players play. (Field: on or off.)
Shown By
Section titled “Shown By”firstCursor: text = “P1 Cursor”. The first player’s cursor, by name: moved over the card they’re on. (Names an entity.) (Field: an entity’s name.)secondCursor: text = “P2 Cursor”. The second player’s cursor, by name. (Names an entity.) (Field: an entity’s name.)firstPreview: text = “P1 Preview”. What shows the first player’s character big, by name: its sprite (and animation) take the character’s. (Names an entity.) (Field: an entity’s name.)secondPreview: text = “P2 Preview”. What shows the second player’s character big, by name. (Names an entity.) (Field: an entity’s name.)
Sounds
Section titled “Sounds”moveSound: text = null. A sound played as a cursor moves. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)pickSound: text = null. A sound played as a character is picked. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
firstIndex: a whole number = 0. The card the first player is on, from 0. Set by the game. (Field: a number.)secondIndex: a whole number = 1. The card the second player is on, from 0. Set by the game. (Field: a number.)firstPicked: true or false = false. True once the first player has picked. Set by the game. (Field: on or off.)secondPicked: true or false = false. True once the second player (or the computer) has picked. Set by the game. (Field: on or off.)timer: a number = 0. Seconds until the scene loads, once everyone has picked. Set by the game. (Field: a number.)
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”).
SwapControls. Swaps the first two players’ controls: the one at the keyboard and the one on the controller change places (kept with the player’s settings).Pick(done with a name, its character: a trigger’s with). Picks the character called character for the first player still choosing, as a click on its card does.Focus. Gives its entity the player’s input: whatever there and inside it has focus, and everything else the same player plays loses it (a platformer’s player stops on the arrow keys while a board takes them).
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.
FirstReady(true or false). True once the first player has picked. Set by the game.SecondReady(true or false). True once the second player (or the computer) has picked. Set by the game.First(a name). The character the first player is on (or picked): its name.Second(a name). The character the second player (or the computer) is on.FirstStatus(a name). “Ready!” once the first player has picked, “Choose” until then: a label.SecondStatus(a name). “Ready!” once the second player has picked; “Computer” for the computer’s.FirstControls(a name). What the first player plays with: “Left keys (WASD)”, “Gamepad 1”… Set by the game.SecondControls(a name). What the second player plays with. Set by the game.
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.
characterList: lines of text: an array of strings, or one string with line breaks. Its Characters, one by one.firstName: text. The character the first player is on (or picked): its name.secondName: text. The character the second player (or the computer) is on.firstStatus: text. “Ready!” once the first player has picked, “Choose” until then: a label.secondStatus: text. “Ready!” once the second player has picked; “Computer” for the computer’s.firstControls: text. What the first player plays with: “Left keys (WASD)”, “Gamepad 1”… Set by the game.secondControls: text. What the second player plays with. Set by the game.
Scripts use it as CharacterSelect: its methods, events and values that aren’t saved with the scene.