Exemplo n.º 1
0
    private void MoveCharacter(float delta)
    {
        if (hitstun != 0)
        {
            //Kraft soll nur am Anfang auf die Katze wirken wenn getroffen
            if (hitstun >= 15)

            {
                velocity   = knockDir.Normalized() * MOVE_SPEED * 1.5f;
                velocity.x = velocity.x * -move_direction;
                velocity.y = jump_velocity / 3;
            }
        }
        else if (attack == false)
        {
            velocity.x = Mathf.Lerp(velocity.x, MOVE_SPEED * move_direction, 0.2f);
        }

        velocity.y += GRAVITY * delta;
        //Return Value of MoveAndSlide is the not used velocity -> should help for Gravity if standing on floor
        //nicht wenn attacking erstmal
        if (!attack)
        {
            damage_loop();
        }
        else if (attackstun > 0)
        {
            if (attackstun < meleeTime)
            {
                if (animNode.GetFrame() == 3)
                {
                    animNode.SetFrame(3);
                }
            }
            //Nur am Anfang der Attack soll der Player in eine Richtung gepusht werden
            else if (attackstun == meleeTime)
            {
                velocity.x = 1.5f * MOVE_SPEED * attack_move_direction;
            }
            else if (attackstun == 1)
            {
                attack = false;
            }
            attackstun -= 1;
        }
    }
Exemplo n.º 2
0
 public override void _Process(float delta)
 {
     collision.Disabled = !(animation.GetFrame() >= 5);
 }