ComputerFighter
Has the computer play a FightingCharacter, for one player against the computer and for a training dummy: it walks in, attacks with the fighter’s own moves when it’s close enough, guards (low against a low) as its opponent attacks, jumps in with an air move now and then, and cancels a hit into a special. Or it just stands, crouches or jumps, for training (Behavior). It works the fighter as a player would, holding directions and doing moves by name, so the fighter’s frame data, blocking and combos are the same either way.
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.
What it decides comes from its own Seed, kept with the scene, so the same fight goes the same way every time and after a rewind. The fighter’s own controls are ignored while it has one.
Requires: FightingCharacter
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.
behavior: one of Fight, Stand, Crouch, Jump = “Fight”. What it does: fight, or stand, crouch or jump as a training dummy. (Field: one of its values.)difficulty: one of Easy, Normal, Hard = “Normal”. How well it fights: how quickly it reacts, how often it guards and attacks. (Field: one of its values.)range: a number = 1.5. How close it closes in before attacking, in units between their middles. (Field: a number.)useMoves: text = null. The moves it uses, by name, separated by commas; empty for every one the fighter has. (Names several of its fighter’s moves, separated by commas; empty for every one. The Inspector ticks them from a list and flags a name that isn’t one.) (Field: its own editor: Choices Of.)
seed: a whole number = 1. Where its next choice comes from: the same seed makes the same fight. Set by the game as it chooses. (Field: a number.)wait: a whole number = 0. Steps until it chooses what to do next. Set by the game. (Field: a number.)holdX: a whole number = 0. Which way it holds the stick now, in the world: -1 left, 1 right. Set by the game. (Field: a number.)holdY: a whole number = 0. Whether it holds the stick up (1) or down (-1). Set by the game. (Field: a number.)guarding: true or false = false. True while it’s guarding against the move its opponent is doing. Set by the game. (Field: on or off.)sawMove: text = null. The step its opponent’s move it has already chosen whether to guard against started on, as “move@frame”. Set by the game. (Plain text: the move it last read: the game sets it.) (Field: text.)
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”).
NextBehavior. Changes its Behavior to the next: Fight, Stand, Crouch, Jump, and round again (a training dummy’s).
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.
Behavior(a name). Its Behavior in words, for a training menu’s label: “Fight”, “Stand”, “Crouch” or “Jump”.
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.
behaviorName: text. Its Behavior in words, for a training menu’s label: “Fight”, “Stand”, “Crouch” or “Jump”.
Scripts use it as ComputerFighter: its methods, events and values that aren’t saved with the scene.