예제 #1
0
        private void go(double angle)
        {
            //initPosition = position + centerPosition;
            float distance = Vector2.Distance(new Vector2(initPosition.X, initPosition.Y), new Vector2(endPosition.X, endPosition.Y));

            if (combo > maxCombo)
            {
                maxCombo = combo;
            }
            if (fallings > maxJumps)
            {
                maxJumps = fallings;
            }
            combo = 0;
            if (distance > range / 2.5)// || velocity.Y != 0)
            {
                gravity = (behaviour.gravity + levelBehaviour.gravity) / 2;
                angle   = angle / 180 * 3.14;
                float vel = (force + (velocityFactor < 18 ? (float)velocityFactor / 100f : 0f));
                velocity.X   = -(float)Math.Sin(angle) * distance * vel;
                velocity.Y   = (float)((float)Math.Cos(angle) * distance * vel);
                endPosition  = new Vector2(-100, -100);
                initPosition = new Vector2(-100, -100);
                spriteSheet.play(AnimationStruct.JUMP);
                Game1.playSound("jump");
                if (inFloor)
                {
                    FXFall tempFX = new FXFall(position.X + (spriteEffects == SpriteEffects.FlipHorizontally ? 10 : 0), (float)(limitBaseY + centerPosition.Y + 28));
                    GameScreen.getBackEntityFXLayer().add(tempFX);
                    tempFX.init(content);
                }
                inFloor = false;
                fallings++;
            }
        }
예제 #2
0
        public override void update(GameTime gameTime)
        {
            base.update(gameTime);
            if (position.Y >= limitBaseY)
            {
                if (!isRunning)
                {
                    if (spriteSheet.currentAnimation.name != "FALLING")
                    {
                        FXFall tempFX = new FXFall(position.X + (spriteEffects == SpriteEffects.FlipHorizontally ? 8 : 0), (float)(limitBaseY + centerPosition.Y + 20));
                        GameScreen.getBackEntityFXLayer().add(tempFX);
                        tempFX.init(content);
                    }
                    spriteSheet.play("FALLING");
                }
            }

            if (position.X > 820 || position.X < -50)
            {
                dead = true;
            }
        }