https://github.com/bluemagic123/tMo...virtual-bool-ontilecollidevector2-oldvelocitySo now first ignore my guard issues, let me focus on some projectiles.
I'm trying to make myself a kind of bullet, maybe some sorta Purification Bullet, I guess.
Basically it will create a purification powder when it hits tiles.
I do it like this, in OnTileCollide hook:
It works fine both on damage and purifiaction function, but there is still something wrong with the projectile. When the purification powder reaches the end, it will stay there and keep doing damage for up to 20 times. I guess this may have something to do with the timeLeft of the projectile, maybe the lasting time of purification is longer than the usual. So, how can I change lating time of a New Projectile? Or just how should I fix this?Code:
Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X, projectile.velocity.Y, 10, (int)((double)projectile.damage * 0.1), 0f, projectile.owner, ProjectileID.PurificationPowder);
By the way, upon this function, is it possible to adjust the purification range? The purification range seems to have nothing to do with the actual projectile.
Are you returning true or false in your OnTileCollide? My guess is the projectile isn't being killed because you return false, so it keeps spawning purification powders as it sits there, colliding each frame. Either kill it or return true to kill it.
Changing purification range would probably mean making your own purifying projectile, not just spawning one. Maybe you can spawn more than one? One at position and the second further along the velocity vector?