Exemple #1
0
        // TODO: Figure out light stuffs
        public SeaLink(float x, float y, float babies, Vector2 offset)
            : base(x - offset.X, y - offset.Y, 4, 1.0f)
        {
            // Initialize sprite
            sprite.CenterOrigin();
            Graphic = sprite;

            this.babies = babies;

            dirStepAmount = 1.3f;

            // Set up colliders
            SetHitbox(28, 28, (int)Tags.ENEMY);
            personalSpace = new CircleCollider((int)(spaceAmount * 0.5), (int)Tags.SEALINK, (int)Tags.ENEMYATTACK);
            AddCollider(personalSpace);

            if (offset == Vector2.Zero) {
                velocity = new Vector2(0, speed);
                velocity = Util.Rotate(velocity, Rand.Angle);
            } else {
                velocity = offset;
                velocity.Normalize();
                velocity = Util.Rotate(velocity, 4);
            }

            sprite.Scale = 0.1f;
        }
 public Projectile(float x, float y, Vector2 direction, float speed, int radius, float lifespan, int damage, params int[] tags)
     : base(x, y)
 {
     direction.Normalize();
     this.velocity = direction * speed;
     this.lifespan = lifespan;
     Collider = new CircleCollider(radius, tags);
     Collider.CenterOrigin();
     this.damage = damage;
 }
Exemple #3
0
        public FatFish(float x, float y, bool baby = false)
            : base(x, y, 10, 0.5f)
        {
            if (baby) {
                // TODO: Set scale
            }

            sprite.CenterOrigin();
            Graphic = sprite;

            Collider = new CircleCollider(50, (int)Tags.ENEMY, (int)Tags.FATFISH);
            Collider.CenterOrigin();

            // Initilize velocity values
            velocity = new Vector2(0, 1);
            velocity = Util.Rotate(velocity, Rand.Int(0, 360));
            minspeed = 2.0f;
            sprite.Angle = Util.RAD_TO_DEG * (float)Math.Atan2(-velocity.Y, velocity.X) - 90;
            direction = velocity;
        }
Exemple #4
0
        public Ink(float x, float y, float angle)
            : base(x, y)
        {
            // Init sprite
            sprite.Add(AnimType.Go, new Anim(new int[] { 0, 1, 2 }, new float[] { 8.0f }));
            sprite.Play(AnimType.Go);
            sprite.CenterOrigin();
            sprite.Angle = angle;
            offset = Util.Rotate(offset, sprite.Angle);
            sprite.OriginX += offset.X;
            sprite.OriginY += offset.Y;
            offset.Normalize();
            offset *= 2.7f;
            Graphic = sprite;

            // Set up collider
            Collider = new CircleCollider(250, (int)Tags.INK);
            Collider.CenterOrigin();

            // Get that sound
            snd.Volume = 0.01f;
            snd.Play();
        }
Exemple #5
0
 protected override IEnumerator Death()
 {
     if (child != null) {
         child.head = null;
         child.target = null;
     }
     if (head != null) {
         head.child = null;
     }
     if (personalSpace != null) {
         personalSpace.RemoveTag((int)Tags.SEALINK);
         personalSpace = null;
     }
     yield return base.Death();
 }