Exemple #1
0
        private void ShootBolt(FInt rotation, int midX, int midY)
        {
            FInt r    = FPRadians.Normalize(rotation);
            FInt velX = FInt.Create(Radians.GetXFromRotation((float)r.ToDouble(), (float)this.attSpeed.ToDouble()));
            FInt velY = FInt.Create(Radians.GetYFromRotation((float)r.ToDouble(), (float)this.attSpeed.ToDouble()));

            ProjectileEnemy projectile = ProjectileEnemy.Create(room, (byte)ProjectileEnemySubType.BoltBlue, FVector.Create(midX - 10, midY + 4), FVector.Create(velX, velY));

            projectile.physics.SetGravity(FInt.Create(0));
            projectile.rotation = (float)r.ToDouble();
        }
Exemple #2
0
        public override void RunTick()
        {
            base.RunTick();

            // Check if an attack needs to be made:
            if (this.attack.AttackThisFrame())
            {
                ProjectileEnemy projectile = ProjectileEnemy.Create(room, (byte)ProjectileEnemySubType.Electric, FVector.Create(this.posX + this.bounds.MidX - 10, this.posY + this.bounds.MidY + 4), FVector.Create(this.FaceRight ? this.attSpeed : -this.attSpeed, -5));
                projectile.physics.SetGravity(this.gravity);
                this.room.PlaySound(Systems.sounds.flame, 0.6f, this.posX + 16, this.posY + 16);
            }
        }
Exemple #3
0
        public static ProjectileEnemy Create(RoomScene room, byte subType, FVector pos, FVector velocity)
        {
            // Retrieve an available projectile from the pool.
            ProjectileEnemy projectile = ProjectilePool.ProjectileEnemy.GetObject();

            projectile.ResetProjectile(room, subType, pos, velocity);
            projectile.spinRate = projectile.physics.velocity.X > 0 ? 0.05f : -0.05f;
            projectile.AssignSubType(subType);
            projectile.AssignBoundsByAtlas(2, 2, -2, -2);
            projectile.physics.SetGravity(FInt.Create(0));

            // Add the Projectile to Scene
            room.AddToScene(projectile, false);

            return(projectile);
        }
Exemple #4
0
        public void FireAttack(RoomScene room, short gridX, short gridY, short attX, short attY, float gravity)
        {
            ProjectileEnemy projectile = ProjectileEnemy.Create(room, (byte)ProjectileEnemySubType.Fire, FVector.Create(gridX * (byte)TilemapEnum.TileWidth + (byte)TilemapEnum.HalfWidth - 10, gridY * (byte)TilemapEnum.TileHeight + (byte)TilemapEnum.HalfHeight - 10), FVector.Create(attX, attY));

            projectile.physics.SetGravity(FInt.Create(gravity * 0.35));
        }