public void keyPressed(KeyEvent e) {
        int key = e.getKeyCode();
        if (key == KeyEvent.VK_SPACE) {
            Cast(); //action that shoots a FrostBolt. 
        }
        if (key == KeyEvent.VK_LEFT) {
        	if(x <= 0+image.getWidth(null)){
        		x = 0;
    			keyReleasedLeft(e);
    		}else{
        	negdx = -movement_speed;
            this.direction = "LEFT";
    		}
        }
        
        if(key == KeyEvent.VK_RIGHT) {
        	if(x >= Skeleton.width-image.getWidth(null)){
        		x = Skeleton.width-image.getWidth(null);
        		keyReleasedRight(e);
        	}else{
            posdx = movement_speed;}
            this.direction = "RIGHT";
        }

        if (key == KeyEvent.VK_UP) {
        	if(y <= 0+image.getHeight(null)){
        		y = 0+image.getHeight(null);
        		keyReleasedUp(e);
        	}else{
            negdy = -movement_speed;
            this.direction = "UP";
        	}
        }

        if (key == KeyEvent.VK_DOWN) {
        	if(y >= Skeleton.height-image.getHeight(null)){
        		y = Skeleton.height-image.getHeight(null);
    			keyReleasedDown(e);
    		}else{
            posdy = movement_speed;
            this.direction = "DOWN";
    		}
        }
	}