Skip to content

CustomProjectile

Timothy Barela edited this page Jan 23, 2018 · 8 revisions

Note: This is a work in progress!

CustomProjectile

Json Definition

{
	"Name": "projectile-name",
	"ScriptPath": "Projectile.boo",
	"BaseType": 134,
	"BaseOverride" : {
		"AiStyle" :  0,
		"Ai": [ 0, 0 ],
		"Damage" : 10,
		"KnockBack" : 60,
		"Friendly": false,
		"Hostile" : true,
		"MaxPenetrate" :  0,
		"TileCollide": true,
		"IgnoreWater" : false,
		"TimeLeft": 100,
		"ColdDamage": false,
		"Magic" : false,
		"Thrown" : false,
		"Melee" : false,
		"Light" : false
	}
}

CustomProjectile Event Callbacks

  • OnSpawn(projectile as CustomProjectile)
  • OnKilled(projectile as CustomProjectile)
  • OnGameUpdate(projectile as CustomProjectile) as bool
  • OnAiUpdate(projectile as CustomProjectile) as bool
  • OnCollision(projectile as CustomProjectile, player as TSPlayer)
  • OnTileCollision(projectile as CustomProjectile, tileHits as List[of Point])

Important: these are the real signatures, but you may omit the types since the compiler will insert them for you. However, make sure whatever you return from your callbacks matches the signature!

CustomProjectile Properties

  • Projectile Projectile {get; set; }
  • ProjectileDefinition Definition {get; set;}
  • int Index { get; set; }
  • bool Active { get; set; }
  • Vector2 Center { get; set; }
  • Vector2 OldPosition {get; set; }
  • Vector2 Position {get; set; }
  • Vector2 OldDirection {get; set; }
  • Vector2 Direction {get; set; }
  • bool SendNetUpdate { get; set; }
  • Vector2 Velocity {get; set; }
  • int TimeLeft { get; set; }
  • int Damage {get; set; }
  • float Knockback { get; set; }
  • int Owner {get; set; }
  • float[] Ai { get; }

CustomProjectile Methods

  • HasVariable(string variableName) : bool
  • GetVariable(string variableName, object defaultValue = null) : object
  • SetVariable(string variableName, object value)
  • Kill()
  • BasicUpdate()

Clone this wiki locally