// Update is called once per frame, loop
    void Update()
    {
        lifetext.text = "Life: " + Mathf.Round(life);

        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            myridgedbody.velocity = new Vector2(tempMoveSpeedUp, myridgedbody.velocity.y);
            //  movespeed = tempMoveSpeedUp;
        }
        else if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            myridgedbody.velocity = new Vector2(tempMoveSpeedDown, myridgedbody.velocity.y);
            //movespeed = tempMoveSpeedDown;
        }
        else
        {
            //movespeed = normalMoveSpeed;
            myridgedbody.velocity = new Vector2(movespeed, myridgedbody.velocity.y); //folyamatosan megy előre a movespeedben megadott érték szerint, felfelé nem mozog magátol
        }



        if (transform.position.x > speedMilestoneCounte)
        {
            speedMilestoneCounte += speedIncreaseMilestone;               //ha eléri hozzáad
            movespeed             = movespeed * speedmulti;               // növekedészik a sebeség

            speedIncreaseMilestone = speedIncreaseMilestone * speedmulti; // egyre messzebb vannak egymástól a növekedési pontok



            tempMoveSpeedUp = movespeed * speedup;

            tempMoveSpeedDown = movespeed * speeddown;
        }


        grounded = Physics2D.OverlapCircle(groundcheck.position, groundcheckR, whatisground); // ha a player collider-e hozzáér a földhöz akkor igaz


        if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W) || Input.GetMouseButtonDown(0)) // space-re és ball clickre ugrik
        {
            if (grounded)                                                                                    // első ugrás
            {
                myridgedbody.velocity = new Vector2(myridgedbody.velocity.x, jumpforce);
                stoppedjumping        = false;
                sound.JumpSound();
            }

            if (!grounded && candoublejump)// második ugrás
            {
                myridgedbody.velocity = new Vector2(myridgedbody.velocity.x, jumpforce);
                jumptimecounter       = jumptime;
                stoppedjumping        = false;
                candoublejump         = false; // nem ugorhat többet
                sound.JumpSound();
            }
        }

        if ((Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W) || Input.GetMouseButton(0)) && !stoppedjumping)   // ha tovább nyomjuk a gombot magasabbra ugrik a karakter
        {
            if (jumptimecounter > 0)
            {
                myridgedbody.velocity = new Vector2(myridgedbody.velocity.x, jumpforce);

                jumptimecounter -= Time.deltaTime;
            }
        }

        if (Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.W) || Input.GetMouseButtonUp(0))      //amég as levegőben van 0 a számláló, így nem lehet folyamatosan ugrani
        {
            jumptimecounter = 0;
            stoppedjumping  = true;
        }


        if (grounded) //ha a földön van ujra indul a számlálás, különben a következő frame-ben nem ugrana
        {
            jumptimecounter = jumptime;
            candoublejump   = true;
        }

        myanimator.SetFloat("speed", myridgedbody.velocity.x); //  a sebeséget a ridegbodybd határozza meg, velocity.x-ként
        myanimator.SetBool("grounded", grounded);              // az animátornál tabál lévő értékeket álítja



        if (Input.GetKeyDown(KeyCode.Space))
        {
            shoot.Fire();
        }


        if (Input.GetKeyDown(KeyCode.P)) // space-re és ball clickre ugrik
        {
            pause.Pausegame();
        }
    }
    void Update()
    {
        lifetext.text = "Life: " + Mathf.Round(life);

        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            myridgedbody.velocity = new Vector2(tempMoveSpeedUp, myridgedbody.velocity.y);
        }
        else if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            myridgedbody.velocity = new Vector2(tempMoveSpeedDown, myridgedbody.velocity.y);
        }
        else
        {
            myridgedbody.velocity = new Vector2(movespeed, myridgedbody.velocity.y);
        }



        if (transform.position.x > speedMilestoneCounte)
        {
            speedMilestoneCounte += speedIncreaseMilestone;
            movespeed             = movespeed * speedmulti;

            speedIncreaseMilestone = speedIncreaseMilestone * speedmulti;



            tempMoveSpeedUp = movespeed * speedup;

            tempMoveSpeedDown = movespeed * speeddown;
        }


        grounded = Physics2D.OverlapCircle(groundcheck.position, groundcheckR, whatisground);


        if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W))
        {
            if (grounded)
            {
                myridgedbody.velocity = new Vector2(myridgedbody.velocity.x, jumpforce);
                stoppedjumping        = false;
                sound.JumpSound();
            }

            if (!grounded && candoublejump)
            {
                myridgedbody.velocity = new Vector2(myridgedbody.velocity.x, jumpforce);
                jumptimecounter       = jumptime;
                stoppedjumping        = false;
                candoublejump         = false;
                sound.JumpSound();
            }
        }

        if ((Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) && !stoppedjumping)
        {
            if (jumptimecounter > 0)
            {
                myridgedbody.velocity = new Vector2(myridgedbody.velocity.x, jumpforce);

                jumptimecounter -= Time.deltaTime;
            }
        }

        if (Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.W))
        {
            jumptimecounter = 0;
            stoppedjumping  = true;
        }


        if (grounded)
        {
            jumptimecounter = jumptime;
            candoublejump   = true;
        }

        myanimator.SetFloat("speed", myridgedbody.velocity.x);
        myanimator.SetBool("grounded", grounded);



        if (Input.GetKeyDown(KeyCode.Space))
        {
            shoot.Fire();
        }


        if (Input.GetKeyDown(KeyCode.P))
        {
            pause.Pausegame();
        }
    }