-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathVoidSpawner.cs
52 lines (49 loc) · 1.78 KB
/
VoidSpawner.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using Terraria.ModLoader;
using Terraria;
using Microsoft.Xna.Framework;
namespace EnemyMods.Projectiles
{
public class VoidSpawner : ModProjectile
{
public override void SetDefaults()
{
projectile.width = 1;
projectile.height = 1;
projectile.timeLeft = 90;
projectile.penetrate = -1;
projectile.hostile = false;
projectile.magic = true;
projectile.tileCollide = false;
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Void Breach");
}
public override bool? CanHitNPC(NPC target)
{
return false;
}
public override void AI()
{
projectile.ai[1] += 1f;
if (projectile.ai[1] >= 4f)
{
projectile.ai[1] = 0f;
for (int i = 0; i < 3; i++)
{
int d = Dust.NewDust(new Vector2(projectile.position.X + Main.rand.Next(-20, 21), projectile.position.Y + Main.rand.Next(-20, 21)), projectile.width, projectile.height, mod.DustType("VoidDust"), (Main.rand.Next(-15, 16)) * .3f, (Main.rand.Next(-15, 16)) * .3f);
Main.dust[d].noGravity = false;
}
}
}
public override void Kill(int timeLeft)
{
//find a sound to play here
Vector2 velocity = new Vector2(Main.player[(int)projectile.ai[0]].Center.X - projectile.position.X, Main.player[(int)projectile.ai[0]].Center.Y - projectile.position.Y);
velocity.Normalize();
velocity *= 3.4f;
Projectile.NewProjectile(projectile.position, velocity, mod.ProjectileType("VoidTendril"), projectile.damage, 2);
}
}
}