Using weapons and bullets

Knowledgebase / Using weapons and bullets

weapon-and-bullet
Weapons from the Gamefroot Classic Pack have a Weapon script attached to them. This script makes the weapon attach to the player when the player picks it up, and shoots bullets* when the player presses spacebar. For the weapon to work properly, a bullet must be placed somewhere in the level (or else the game will crash when the weapon is picked up).
To change its properties, right-click on it and select Instance Properties.
 weapon
These are the properties you can change on a weapon:
  • Gun autofire: Set this to true to enable fully automatic fire, which means you can hold spacebar down and bullets will keep shooting out.
  • Gun reload time: The time delay between shots (in milliseconds. 1000ms = 1 second)
  • Gun muzzle velocity: The speed of the bullets.
  • Collector tag: The tag of the object that can collect this weapon (default is player).
  • Bullet id tag: The tag of the object that is shot out of this weapon (default is bullet).
  • Gun burst shots: The amount of bullets in a single shot.
  • Gun burst interval: The delay between bullets in a single shot.
  • Gun shot duration: The amount of time that a bullet lasts for until it disappears.

Bullets from the Gamefroot Classic Pack have a Bullet script attached to them. This script makes bullets fire out of any weapon or NPC that can shoot. For shooting to work in your game, a bullet must be placed somewhere in the level.

bullet
These are the properties you can change on a bullet:
  • Bullet tag: this is the tag that other game objects (characters, weapons, etc.) use to identify the bullet so they can use it.
  • Damage: the amount of health that a character loses when the bullet hits them.