Blockland Forums > Modification Help
On Brick Hit If Projectile
jes00:
How would I code a brick so that when it's hit it checks if the projectile is SkillPickaxe and if so it does stuff?
otto-san:
On the projectile's onCollision function, if it hits a brick, make it process the input event.
jes00:
--- Quote from: otto-san on November 25, 2011, 04:54:14 PM ---if it hits a brick, make it process the input event.
--- End quote ---
How would I make it check if it hit a brick? why would I want to process the input event?
Superb:
Something like yourweaponprojectile::oncollision
Destiny/Zack0Wack0:
--- Code: ---function SkillPickaxeProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(!(%col.getType() & $TypeMasks::FxBrickObjectType))
return;
//Do brick collision stuff here, %col is the brick, %obj is the projectile
}
--- End code ---
If your projectile is named something different, change the SkillPickaxeProjectile part.