weapon_2d

2D: guns. The object carries weapons and aims them (players: mouse or right stick, with aim assist; others: their script's self.aimAt / self.shoot), or with pickup true it is a gun on the ground for the player to take. Weapons are data: built-ins pistol, smg, shotgun, rifle, rocket, laser, orb (slow glowing enemy bullets), turret, or Assets/Weapons/.weapon.json; tune changes any setting for this object. Shots use action_2d for team, hit-stop and flash; bullets hit hurt boxes (or the body box) of other teams, stop on walls, crates and cover. Scripts: self.aimAt(target), self.shoot(), self.reload(), self.equip(name), self.telegraph(seconds), self.pattern('spiral', {...}), self.weapon; onMessage 'fired', 'reloaded', 'weapon_pickup'.

In scene text

weapon_2d { weapon "…"  carried ["a", "b"]  ammo ["a", "b"] }

Add it in the Inspector (Add Component), in scene text as above, or ask your AI. Fields you leave out keep their defaults.

Fields 21

FieldTypeUnit / rangeWhat it does
weapontext—The weapon in hand: pistol, smg, shotgun, rifle, rocket, laser, orb, turret, or a project weapon file's name.
carriedlist of text—Everything it carries (switch with Q, 1-6, the pad's Y): ["pistol", "shotgun"].
ammolist of text—Spare rounds: ["shotgun=24", "all=200"] (unlisted: the weapon's own reserve; -1 endless).
tunelist of text—This object's changes to weapon settings: ["knockback=900", "shotgun.pellets=10", "fire_rate=12", "auto=true"]. weapon_2d_presets lists every setting.
controltext—auto
aim_assistnumber0 … 1Gamepad aim assist: 0 none ... 1 strong (bends the stick's aim toward the closest enemy in a cone).
shoulder(x, y, z)unitsWhere the arm turns from the position (art facing right; mirrored when aiming left).
armtext—
arm_lengthnumberunits, 0 … 400Shoulder to grip.
arm_widthnumberunits, 0 … 200The drawn arm's thickness.
arm_rect(x, y, z)unitsWhere the arm picture lies along the arm from the shoulder: (start, end, thickness); zero: automatic.
draw_guntrue / false—Draws the gun (and arm) turned to the aim.
gun_layernumber-100 … 100Drawn at the sprite's layer plus this (negative: behind the body).
gun_scalenumber0.05 … 20Scales the drawn gun.
face_aimtrue / false—Turns the sprite or rig to face the aim.
crosshairtrue / false—Players: a crosshair at the aim that opens with spread and shows hit markers.
aim_leadnumberunits, 0 … 1000Players: the camera leans this far toward the aim.
pickuptrue / false—A gun on the ground: the first player to touch it takes weapon (and pickup_ammo rounds); weapon "ammo" refills what it carries.
pickup_ammonumber0 … 100000Rounds a pickup gives (0: the weapon's reserve).
pickup_radiusnumberunits, 1 … 2000How close a player must come to take a pickup.
enabledtrue / false—On.
Arcwright Beta 2 (0.4.0) · generated from the engine source (25e375c86)Something wrong or missing? Tell us
Download Arcwright free