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 #2
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 #3
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();
        }