コード例 #1
0
        public float getAcceleration(HumptyDumpty humptyDumpty)
        {
            float  baseAccelerationFactor = 90f;
            Random random = new Random();



            int value = humptyDumpty.Level;

            switch (value) // humptyDumpty.Level
            {
            case 5: baseAccelerationFactor = 22; break;

            case 4: baseAccelerationFactor = 30; break;

            case 3: baseAccelerationFactor = 33; break;

            case 2: baseAccelerationFactor = 37; break;

            case 1: baseAccelerationFactor = 40; break;

            default: baseAccelerationFactor = 20; break;
            }

            return(baseAccelerationFactor + GameScreen.positiveOrNegative() * (float)(random.NextDouble() + 1));
        }
コード例 #2
0
        public Projectile(TextureHandler t, HumptyDumpty humptyDumpty)
        {
            setDestination(humptyDumpty.Position);
            hitbox = new Rectangle((int)position.X, (int)position.Y, 10, 10);
            trajectory = new Rectangle((int)position.X, (int)position.Y, 2, 100);
            this.humptyDumpty = humptyDumpty;

            Random r = new Random();
            projectileType = (ProjectileType)r.Next(7);
            texture = t.getProjectile(projectileType);
        }
コード例 #3
0
        public Projectile(TextureHandler t, HumptyDumpty humptyDumpty)
        {
            setDestination(humptyDumpty.Position);
            hitbox            = new Rectangle((int)position.X, (int)position.Y, 10, 10);
            trajectory        = new Rectangle((int)position.X, (int)position.Y, 2, 100);
            this.humptyDumpty = humptyDumpty;

            Random r = new Random();

            projectileType = (ProjectileType)r.Next(7);
            texture        = t.getProjectile(projectileType);
        }
コード例 #4
0
        public void Update(GameTime gameTime, HumptyDumpty humptyDumpty)
        {
            elapsedLifeSpanInSeconds += gameTime.ElapsedGameTime.Milliseconds;
            if (this.humptyDumpty == null)
            {
                this.humptyDumpty = humptyDumpty;
            }


            if (elapsedLifeSpanInSeconds > secondsToWait * 1000)
            {
                hitbox.X = (int)position.X;
                hitbox.Y = (int)position.Y;
                if (hitbox.Intersects(humptyDumpty.hitbox))
                {
                    humptyDumpty.Status = HumptyDumpty.DEAD;
                }
                setPosition();
                rotation += getAcceleration(humptyDumpty) / 150.0F;
            }
        }
コード例 #5
0
        public float getAcceleration(HumptyDumpty humptyDumpty)
        {
            float baseAccelerationFactor = 90f;
            Random random = new Random();

            int value = humptyDumpty.Level;
            switch (value) // humptyDumpty.Level
            {
                case 5: baseAccelerationFactor = 22; break;
                case 4: baseAccelerationFactor = 30; break;
                case 3: baseAccelerationFactor = 33; break;
                case 2: baseAccelerationFactor = 37; break;
                case 1: baseAccelerationFactor = 40; break;
                default: baseAccelerationFactor = 20; break;
            }

            return baseAccelerationFactor + GameScreen.positiveOrNegative() * (float)(random.NextDouble() + 1);
        }
コード例 #6
0
        public void Update(GameTime gameTime, HumptyDumpty humptyDumpty)
        {
            elapsedLifeSpanInSeconds += gameTime.ElapsedGameTime.Milliseconds;
            if (this.humptyDumpty == null)
                this.humptyDumpty = humptyDumpty;

            if (elapsedLifeSpanInSeconds > secondsToWait * 1000)
            {
                hitbox.X = (int)position.X;
                hitbox.Y = (int)position.Y;
                if (hitbox.Intersects(humptyDumpty.hitbox))
                {
                    humptyDumpty.Status = HumptyDumpty.DEAD;
                }
                setPosition();
                rotation += getAcceleration(humptyDumpty) / 150.0F;
            }
        }
コード例 #7
0
 public King(TextureHandler t, HumptyDumpty h)
 {
     humptyDumpty   = h;
     textureHandler = t;
     Initialize();
 }
コード例 #8
0
ファイル: King.cs プロジェクト: darrensapalo/HumptyDumpty
 public King(TextureHandler t, HumptyDumpty h)
 {
     humptyDumpty = h;
     textureHandler = t;
     Initialize();
 }