public void CheckKey()
    {
               
        if(Greenfoot.isKeyDown("right"))
        {
            //direction = 1;
            moveRight();
        }
        if(Greenfoot.isKeyDown("left"))
        {
            //direction = -1;
            moveLeft();
        }
        if((Greenfoot.isKeyDown("up") || Greenfoot.isKeyDown("space"))&& jumping == false)
        {
            jump();
        }
    }