Ejemplo n.º 1
0
        public override void tick()
        {
            dest     = Game.instance.targetDestination();
            velocity = (dest - position).normalized * SkeletonKingMiniboss.frost_speed;
            if (exploding)
            {
                frame += (int)(1000 * SkeletonKingMiniboss.frost_explode_anim_speed / 60);
                if (frame >= 900)
                {
                    remove = true;
                }
                return;
            }

            position += velocity;
            angle     = Util.angle(velocity) + (float)Math.PI;

            if ((position - dest).magnitude < 30)
            {
                Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
                if (dest == Game.instance.targetDestination())
                {
                    Game.instance.damageTargetPiece(SkeletonKingMiniboss.frost_damage);
                }
                kill();
            }
        }
Ejemplo n.º 2
0
 public DrDogMinion2Bullet(Vector2 position_)
 {
     Choom.PlayEffect(SoundAssets.LaserShot);
     position = position_;
     velocity = new Vector2(-DrDogMinion2.fire_speed, 0);
     size     = new Vector2(30, 30);
 }
Ejemplo n.º 3
0
        public override void tick()
        {
            frame += 15;
            if (time++ % 20 == 0)
            {
                Choom.PlayEffect(SoundAssets.BoomerangShot);
            }

            if (state == State.FIRING)
            {
                position   += velocity;
                velocity.y += HootMinion2.weapon_gravity;
            }
            if (position.x < 250 && hit == false)
            {
                state = State.DYING;
                frame = 0;
                hit   = true;
            }
            if (hit == true && frame > 299)
            {
                remove = true;
                Game.instance.damageTargetPiece(HootMinion2.weapon_damage);
            }
        }
Ejemplo n.º 4
0
        public IceCreamTankBullet(Vector2 position_)
        {
            Choom.PlayEffect(SoundAssets.BoomerangShot);

            position = position_;
            velocity = new Vector2(-IceCreamTank.bullet_speed, -IceCreamTank.bullet_yspeed);
        }
Ejemplo n.º 5
0
 public HootFlyBullet(Vector2 position_)
 {
     Choom.PlayEffect(SoundAssets.Gatling[Util.rng.Next(SoundAssets.Gatling.Length)]);
     position = position_;
     speed    = HootFly.bulet_speed;
     velocity = new Vector2(-speed, 0);
 }
Ejemplo n.º 6
0
 public DrDogMissile(Vector2 position_)
 {
     Choom.PlayEffect(SoundAssets.Gatling[Util.rng.Next(SoundAssets.Gatling.Length)]);
     position = position_;
     angle    = Util.rng.NextFloat((float)Math.PI, (float)Math.PI * 8 / 6);
     velocity = Util.fromPolar(angle, 1);
 }
Ejemplo n.º 7
0
 public PeterMissile(Vector2 position_)
 {
     Choom.PlayEffect(SoundAssets.Gatling[Util.rng.Next(SoundAssets.Gatling.Length)]);
     position = position_;
     angle    = Util.rng.NextFloat(-2 * (float)Math.PI * 8 / 6, -2 * (float)Math.PI);
     velocity = Util.fromPolar(angle, 1.0f);
 }
Ejemplo n.º 8
0
 public IceCreamFlyer2Bullet(Vector2 position_)
 {
     Choom.PlayEffect(SoundAssets.BoomerangShot);
     position = position_;
     speed    = IceCreamFlyer2.bullet_speed;
     velocity = new Vector2(-speed, 0);
 }
Ejemplo n.º 9
0
        public override void tick()
        {
            base.tick();
            if (frozenThisFrame())
            {
                return;
            }

            velocity += new Vector2(0, gravity);
            position += velocity;
            if (position.y > 450)
            {
                position.y = 450;
                velocity.y = 0;
            }

            if (state == State.THROWING)
            {
                frame += 10;
                if (frame > 200 && hasthrown == false)
                {
                    hasthrown = true;
                    Game.instance.enemy_bullet_group.add(
                        new HootMinionBullet(position + new Vector2(-10, -10)));
                }
                if (frame > 400)
                {
                    velocity.x = -Util.rng.NextFloat(approach_speed_min, approach_speed_max);
                    state      = State.WALKING;
                }
            }

            if (position.x > 1100)
            {
                remove = true;
            }

            if (state == State.DYING)
            {
                frame += 10;
                if (frame >= 1000)
                {
                    finishDying();
                }
            }

            if (state == State.WALKING)
            {
                frame += (int)(1000 * Util.rng.NextFloat(run_anim_speed_min, run_anim_speed_max) / 60);
                if (position.x < steal_distance)
                {
                    position.x = steal_distance;
                    velocity.x = -velocity.x;
                    Choom.PlayEffect(SoundAssets.OrphanTake);
                    held_orphans.Add(new Orphan(new Vector2(30, -10)));
                }
            }
        }
Ejemplo n.º 10
0
 public override void startDying()
 {
     if (state == State.DYING)
     {
         return;
     }
     Choom.PlayEffect(SoundAssets.EnemyDie);
     state = State.DYING;
     frame = 0;
 }
Ejemplo n.º 11
0
        public override void tick()
        {
            age += 1 / 60.0f;

            var target_position = Game.instance.targetDestination();

            var dest_velocity = target_position - position;
            var dest_modifier = dest_velocity - velocity;
            var dest_angle    = Util.angle(dest_modifier);

            angle %= (float)Math.PI * 2;
            if (Math.Abs(dest_angle - angle) > Math.Abs(dest_angle + Math.PI * 2 - angle))
            {
                dest_angle += (float)Math.PI * 2;
            }
            if (Math.Abs(dest_angle - angle) > Math.Abs(dest_angle - Math.PI * 2 - angle))
            {
                dest_angle -= (float)Math.PI * 2;
            }

            if (angle < dest_angle)
            {
                angle += DrDog.missile_rotation_speed;
            }
            if (angle > dest_angle)
            {
                angle -= DrDog.missile_rotation_speed;
            }
            if (Math.Abs(dest_angle - angle) < DrDog.missile_rotation_speed)
            {
                angle     = dest_angle;
                velocity += Util.fromPolar(angle, DrDog.missile_acceleration);
            }

            if (velocity.magnitude > DrDog.missile_max_speed)
            {
                velocity = new Vector2(velocity.x, velocity.y).normalized *DrDog.missile_max_speed;
            }

            position += velocity;

            if (position.x < Puzzle.grid_left + Puzzle.piece_size * 3 ||
                age > DrDog.missile_lifetime)
            {
                remove = true;
                Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
                Game.instance.enemy_bullet_group.add(new Explosion(position, Vector2.zero,
                                                                   20, 0, Gun.Ammo.NONE));
                if (age < DrDog.missile_lifetime)
                {
                    Game.instance.damageTargetPiece(DrDog.missile_damage);
                }
            }
        }
Ejemplo n.º 12
0
        public override void startDying()
        {
            if (state == (int)drdog_minion.Sprites.drdog_minion_death1)
            {
                return;
            }

            Choom.PlayEffect(SoundAssets.EnemyDie);
            state     = (int)drdog_minion.Sprites.drdog_minion_death1;
            sub_frame = 0;
        }
Ejemplo n.º 13
0
 public PenguinTankBullet(Vector2 position_, float scale_ = 0)
 {
     Choom.PlayEffect(SoundAssets.Gatling[Util.rng.Next(SoundAssets.Gatling.Length)]);
     scale = new Vector2(-1, 1);
     if (scale_ != 0)
     {
         scale *= scale_;
     }
     position = position_;
     velocity = new Vector2(-PenguinTank.bullet_speed, 0);
 }
Ejemplo n.º 14
0
        public override void startDying()
        {
            if (state == State.DYING)
            {
                return;
            }

            Choom.PlayEffect(SoundAssets.BossDie1);
            state = State.DYING;
            Game.instance.removeBoss();
            frame = 0;
        }
Ejemplo n.º 15
0
        public override void tick()
        {
            frame    += 5.0f;
            position += velocity;

            if (position.x < 250)
            {
                remove = true;
                Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
                Game.instance.enemy_bullet_group.add(new Explosion(position, Vector2.zero, 30, 0, Gun.Ammo.NONE));
                Game.instance.damageTargetPiece(PeterBoss.bullet_damage);
            }
        }
Ejemplo n.º 16
0
 public override void startDying()
 {
     if (state == State.DYING)
     {
         return;
     }
     //position += new Vector2(0, 10);
     state    = State.DYING;
     frame    = 0;
     velocity = Vector2.zero;
     Game.instance.removeBoss();
     Choom.PlayEffect(SoundAssets.BossDie1);
 }
Ejemplo n.º 17
0
 public override void tick()
 {
     frame += 10;
     if (frame == 300)
     {
         Game.instance.particle_group.add(new Pickup(position, 100 * MetaState.healing_coefficient, 0));
         Choom.PlayEffect(SoundAssets.Explosion[Util.rng.Next(SoundAssets.Explosion.Length)]);
     }
     if (frame > 1000)
     {
         remove = true;
     }
 }
Ejemplo n.º 18
0
        public void OnEffectsChanged(Slider slider)
        {
            Choom.EffectVolume = Mathf.Clamp(slider.value, 0, 1);

            if (ignoreEffect)
            {
                ignoreEffect = false; return;
            }
            if (MainMenu.ignoreFocus)
            {
                return;
            }
            Choom.PlayEffect(SoundAssets.UISelect);
        }
Ejemplo n.º 19
0
 public DrDogMiniBullet(Vector2 position_, float speed_ = 0, float damage_ = 0)
 {
     Choom.PlayEffect(SoundAssets.Gatling[Util.rng.Next(SoundAssets.Gatling.Length)]);
     position = position_;
     speed    = speed_;
     damage   = damage_;
     if (speed == 0)
     {
         speed = DrDogMiniboss.bullet_speed;
     }
     if (damage == 0)
     {
         damage = DrDogMiniboss.bullet_damage;
     }
 }
Ejemplo n.º 20
0
 public override void tick()
 {
     position += velocity;
     if (!explode && position.x < Puzzle.grid_left + Puzzle.piece_size * 3)
     {
         Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
         Game.instance.damageTargetPiece(DrDogMinion2.fire_damage);
         explode  = true;
         velocity = Vector2.zero;
         frame    = 0;
     }
     frame += 15;
     if (explode && frame > 290)
     {
         remove = true;
     }
 }
Ejemplo n.º 21
0
        public override void startDying()
        {
            if (state == State.DYING)
            {
                return;
            }

            Choom.PlayEffect(SoundAssets.BossDie2);
            state = State.DYING;
            Game.instance.removeBoss();
            frame = 0;
            for (int i = 0; i < orphans_eaten; i++)
            {
                held_orphans.Add(new Orphan(Vector2.zero));
            }
            releaseOrphans();
        }
Ejemplo n.º 22
0
        public override void tick()
        {
            base.tick();
            if (frozenThisFrame())
            {
                return;
            }

            velocity += new Vector2(0, gravity);
            position += velocity;
            if (position.y > 450)
            {
                position.y = 450;
                velocity.y = 0;
                velocity.x = Math.Sign(velocity.x) * Util.rng.NextFloat(approach_speed_min, approach_speed_max);
            }

            if (position.x > 1100)
            {
                remove = true;
            }

            if (state == State.DYING)
            {
                frame += 10;
                if (frame >= 1000)
                {
                    finishDying();
                }
            }

            if (state == State.WALKING)
            {
                frame += (int)(1000 * Util.rng.NextFloat(run_anim_speed_min, run_anim_speed_max) / 60);
                if (position.x < steal_distance)
                {
                    position.x = steal_distance;
                    velocity.x = -velocity.x;

                    Choom.PlayEffect(SoundAssets.OrphanTake);
                    held_orphans.Add(new Orphan(new Vector2(20, -10)));
                }
            }
        }
Ejemplo n.º 23
0
        public override void tick()
        {
            dest      = Game.instance.targetDestination();
            velocity  = (dest - position).normalized * speed;
            angle     = Util.angle(velocity);
            frame    += DrDogMiniboss.bullet_anim_speed / 60.0f;
            position += velocity;

            Vector2 pos = dest - position;

            if (pos.magnitude < 20)
            {
                Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
                if (dest == Game.instance.targetDestination())
                {
                    Game.instance.damageTargetPiece(DrDogMiniboss.bullet_damage);
                }
                remove = true;
            }
        }
Ejemplo n.º 24
0
 public override void tick()
 {
     frame += 15;
     if (state == State.FIRING)
     {
         position += velocity;
     }
     if (position.x < 250 && hit == false)
     {
         Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
         state = State.DYING;
         frame = 0;
         hit   = true;
     }
     if (hit == true && frame > 399)
     {
         remove = true;
         Game.instance.damageTargetPiece(IceCreamFlyer2.bullet_damage);
     }
 }
Ejemplo n.º 25
0
 public override void tick()
 {
     frame += 15;
     if (state == State.FIRING)
     {
         position += velocity;
         //        velocity.y += HootMinion.weapon_gravity;
     }
     if (position.x < 250 && hit == false)
     {
         state = State.DYING;
         frame = 0;
         hit   = true;
     }
     if (hit == true && frame > 399)
     {
         remove = true;
         Choom.PlayEffect(SoundAssets.HitHouse[Util.rng.Next(SoundAssets.HitHouse.Length)]);
         Game.instance.damageTargetPiece(HootFly.bullet_damage);
     }
 }
Ejemplo n.º 26
0
 public void OnEffectPointerUp()
 {
     Choom.PlayEffect(SoundAssets.UISelect);
 }
Ejemplo n.º 27
0
 public HootTankBullet(Vector2 position_)
 {
     Choom.PlayEffect(SoundAssets.Gatling[Util.rng.Next(SoundAssets.Gatling.Length)], 0.5f);
     position = position_;
     velocity = new Vector2(-HootTank.bullet_speed, 0);
 }
Ejemplo n.º 28
0
        public override void tick()
        {
            base.tick();
            if (frozenThisFrame())
            {
                return;
            }

            if (face1_die_frame >= 0)
            {
                face1_die_frame += 10;
            }
            if (face2_die_frame >= 0)
            {
                face2_die_frame += 10;
            }

            if (state == State.WALKING)
            {
                position += velocity;
                frame    += 10;

                if (Math.Abs(nextpos - position.x) < 5.0f)
                {
                    velocity.x = 0;
                    frame      = 0;
                    if (go_eat)
                    {
                        state       = State.EATING;
                        drop_damage = 0;
                        num_orphans = Util.rng.NextFloat(1, max_orphans);
                    }
                    else
                    {
                        state        = State.IDLING;
                        idle_timeout = (int)Util.rng.NextFloat(idle_time_min, idle_time_max);
                        num_spit     = Util.rng.NextFloat(1, max_spit);
                    }
                }
            }

            if (state == State.EATING)
            {
                frame += 5;
                if (Shield.existing_shield != null)
                {
                    num_orphans = 0;
                }
                if (num_orphans > 0)
                {
                    if (frame > 260 && frame < 560 && !grab_o)
                    {
                        Choom.PlayEffect(SoundAssets.BlockLand);
                        Choom.PlayEffect(SoundAssets.OrphanTake);
                        grab_o = true;
                        go_eat = false;
                    }
                    if (frame >= 560)
                    {
                        if (grab_o)
                        {
                            held_orphans.Add(new Orphan(new Vector2(-70, -10)));
                            grab_o = false;
                        }
                        else
                        {
                            if (drop_damage > orphan_drop_damage)
                            {
                                releaseOrphans();
                                frame      = 0;
                                go_eat     = false;
                                state      = State.WALKING;
                                nextpos    = Util.rng.NextFloat(min_pos, max_pos);
                                velocity.x = Math.Sign(nextpos - position.x) * walk_speed;
                            }
                            else if (frame > 660 & !go_eat)
                            {
                                num_orphans--;
                                Game.instance.house.damage(held_orphans.Count);
                                held_orphans.Clear();
                                go_eat = true;
                            }
                            else if (frame > 860)
                            {
                                frame = 0;
                            }
                        }
                    }
                }
                else
                {
                    frame      = 0;
                    go_eat     = false;
                    state      = State.WALKING;
                    nextpos    = Util.rng.NextFloat(min_pos, max_pos);
                    velocity.x = Math.Sign(nextpos - position.x) * walk_speed;
                }
            }

            if (state == State.IDLING)
            {
                frame += 10;
                if (--idle_timeout <= 0)
                {
                    if (Util.rng.NextFloat(0.0f, 1.0f) > prob_eating)
                    {
                        facing_left = true;
                        state       = State.FIRING;
                        fired       = false;
                        velocity.x  = 0;
                    }
                    else
                    {
                        state      = State.WALKING;
                        go_eat     = true;
                        nextpos    = eat_pos;
                        velocity.x = Math.Sign(nextpos - position.x) * walk_speed;
                    }
                    frame = 0;
                }
            }

            if (state == State.FIRING)
            {
                frame += 10;
                if (frame >= 400 && !fired)
                {
                    fired = true;
                    Game.instance.enemy_bullet_group.add(
                        new IceCreamBossBullet(position + new Vector2(-180, 0)));
                }
                if (frame >= 775)
                {
                    frame = 0;
                    if (--num_spit == 0)
                    {
                        state      = State.WALKING;
                        nextpos    = Util.rng.NextFloat(min_pos, max_pos);
                        velocity.x = Math.Sign(nextpos - position.x) * walk_speed;
                    }
                    else
                    {
                        state        = State.IDLING;
                        idle_timeout = (int)Util.rng.NextFloat(idle_time_min, idle_time_max);
                    }
                }
            }

            if (state == State.DYING)
            {
                frame += 10;
                if (frame >= 700)
                {
                    finishDying();
                }
            }
        }
Ejemplo n.º 29
0
        public override void tick()
        {
            base.tick();
            if (frozenThisFrame())
            {
                return;
            }

            frame += 5;

            if (state == State.FLYING)
            {
                lerp_pos += lerp_speed;
                var smooth_lerp  = Util.smoothStep(lerp_pos);
                var new_position = origin * (1 - smooth_lerp) + destination * smooth_lerp;

                velocity = new_position - position;
                position = new_position;

                if (lerp_pos >= 1.0)
                {
                    state        = State.IDLE;
                    frame        = 0;
                    idle_timeout = (int)(Util.rng.NextFloat(idle_time_min, idle_time_max) * 60);
                }
            }

            if (state == State.IDLE)
            {
                if (--idle_timeout <= 0)
                {
                    frame = 0;
                    if (Util.rng.NextFloat() < grab_chance || Shield.existing_shield != null)
                    {
                        added_orphan = false;
                        drop_damage  = 0;
                        state        = State.GRAB;
                    }
                    else
                    {
                        state = State.LASER;
                        Choom.PlayEffect(SoundAssets.HootLaser);
                    }
                }
            }

            if (state == State.DYING)
            {
                frame += 5;
                if (frame > 1000)
                {
                    remove = true;
                }
            }

            if (state == State.GRAB)
            {
                if (frame >= 700 && !added_orphan)
                {
                    added_orphan = true;
                    int n_grabs = Util.rng.Next(min_orphans_grabbed, max_orphans_grabbed);

                    if (drop_damage > orphan_drop_damage)
                    {
                        for (int i = 0; i < n_grabs; i++)
                        {
                            var o = new Orphan(new Vector2(111 + Util.rng.Next(-40, 40), -95));
                            Game.instance.orphan_group.add(o);
                            o.enterWorld(position + o.position);
                        }
                    }
                    else
                    {
                        Game.instance.house.damage(n_grabs);
                        Choom.PlayEffect(SoundAssets.BlockLand);
                        Choom.PlayEffect(SoundAssets.OrphanTake);

                        for (int i = 0; i < n_grabs; i++)
                        {
                            held_orphans.Add(new Orphan(new Vector2(111 + Util.rng.Next(-40, 40), -95)));
                        }
                    }
                }

                if (frame >= 1000)
                {
                    frame        = 0;
                    idle_timeout = (int)(Util.rng.NextFloat(idle_time_min, idle_time_max) * 60);
                    state        = State.IDLE;
                }
            }

            if (state == State.LASER)
            {
                if (frame > 750 || Shield.existing_shield != null)
                {
                    frame        = 0;
                    idle_timeout = (int)(Util.rng.NextFloat(idle_time_min, idle_time_max) * 60);
                    state        = State.IDLE;
                }
                if (frame >= 300 && frame <= 600)
                {
                    Game.instance.damageTargetPiece(laser_damage);
                }
            }
        }
Ejemplo n.º 30
0
        public override void tick()
        {
            base.tick();
            if (frozenThisFrame())
            {
                return;
            }

            if (state == State.IDLE)
            {
                frame     += 15;
                velocity.y = velocity.y + gravity;
                if (--idle_timeout <= 0)
                {
                    state = State.FLYING;
                    if (--shoots > 0)
                    {
                        setupMove(new Vector2(Util.rng.NextFloat(500, 900), lane + Util.rng.NextFloat(-25, 25)));
                    }
                    else
                    {
                        setupMove(new Vector2(grab_position, lane + Util.rng.NextFloat(-25, 25)));
                    }
                }
            }

            if (state == State.FLYING)
            {
                frame    += 15;
                lerp_pos += lerp_speed;
                if (lerp_pos >= 1.0f)
                {
                    position = destination;
                    velocity = Vector2.zero;
                    if (position.x == grab_position)
                    {
                        state      = State.ESCAPING;
                        velocity.x = 2;
                        Choom.PlayEffect(SoundAssets.OrphanTake);
                        held_orphans.Add(new Orphan(new Vector2(35, 85)));
                        frame = 0;
                    }
                    else
                    {
                        state        = State.SHOOT;
                        fired        = false;
                        idle_timeout = 10;
                        frame        = 400; // 400 because firing animation cycle starts there
                    }
                }
                else
                {
                    var smooth_lerp  = Util.smoothStep(lerp_pos);
                    var new_position = origin * (1 - smooth_lerp) + destination * smooth_lerp;
                    velocity = new_position - position;
                }
            }

            if (state == State.DYING)
            {
                frame += 15;
                if (frame >= 750)
                {
                    finishDying();
                }
            }

            if (state == State.ESCAPING)
            {
                frame += 15;
                if (position.x > 1100)
                {
                    remove = true;
                }
            }

            position += velocity;

            if (state == State.SHOOT)
            {
                facing_left = true;
                frame      += 15;
                if (frame > 800 && !fired)
                {
                    fired = true;
                    Game.instance.enemy_bullet_group.add(new HootFlyBullet(position + new Vector2(-30.0f, 45.0f)));
                    velocity.y = -idle_boost;
                    velocity.x = 2.0f;
                }
                if (frame > 1200)
                {
                    state        = State.IDLE;
                    idle_timeout = 60;
                    frame        = 0;
                }
            }
        }