<commit_before>package engine.state;

import java.awt.event.KeyEvent;

import engine.Control;
import engine.gridobject.GridObject;
import engine.gridobject.Pickupable;
import engine.gridobject.person.Player;

public class WalkAroundState extends AbstractState {

	
	private Player myPlayer;
	
	public WalkAroundState(Player p) {
		super();
		myPlayer = p;
	}
	
	@Override
	public void keyPressed(KeyEvent e) {
		if (e.getKeyCode() == Control.UP){
			myPlayer.setDY(-myPlayer.getSpeed());	
		}
		if (e.getKeyCode() == Control.DOWN){
			myPlayer.setDY(myPlayer.getSpeed());
		}
		if (e.getKeyCode() == Control.RIGHT){
			myPlayer.setDX(myPlayer.getSpeed());
		}
		if (e.getKeyCode() == Control.LEFT){
			myPlayer.setDX(-myPlayer.getSpeed());
		}		
		if (e.getKeyCode() == Control.A) {
			GridObject surrounding = myPlayer.getSurroundingChecker().checkSurroundings(myPlayer).get(0);
			if(surrounding!=null){
				surrounding.doAction();
			}
			if(surrounding.getPickupable()!=null){
				(surrounding.getPickupable()).pickUp(myPlayer);
				surrounding.setPickupable(null);
			}
		}	<commit_msg>fixed bug where if you push A it gives error<commit_after>package engine.state;

import java.awt.event.KeyEvent;

import engine.Control;
import engine.gridobject.GridObject;
import engine.gridobject.Pickupable;
import engine.gridobject.person.Player;

public class WalkAroundState extends AbstractState {

	
	private Player myPlayer;
	
	public WalkAroundState(Player p) {
		super();
		myPlayer = p;
	}
	
	@Override
	public void keyPressed(KeyEvent e) {
		if (e.getKeyCode() == Control.UP){
			myPlayer.setDY(-myPlayer.getSpeed());	
		}
		if (e.getKeyCode() == Control.DOWN){
			myPlayer.setDY(myPlayer.getSpeed());
		}
		if (e.getKeyCode() == Control.RIGHT){
			myPlayer.setDX(myPlayer.getSpeed());
		}
		if (e.getKeyCode() == Control.LEFT){
			myPlayer.setDX(-myPlayer.getSpeed());
		}		
		if (e.getKeyCode() == Control.A) {
			GridObject surrounding = myPlayer.getSurroundingChecker().checkSurroundings(myPlayer).get(0);
			if(surrounding!=null){
				surrounding.doAction();
				if(surrounding.getPickupable()!=null){
					(surrounding.getPickupable()).pickUp(myPlayer);
					surrounding.setPickupable(null);
				}
			}
		}	
{'fraction_non_alphanumeric': 0.14343707713125844, 'fraction_numerical': 0.0009021199819576004, 'mean_word_length': 4.409756097560976, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5699243', 'n_tokens_mistral': 864, 'n_tokens_neox': 759, 'n_words': 125}