<commit_before>package gameAuthoringEnvironment.levelEditor;

//TODO make this work...
import java.util.HashMap;

import gameEngine.GameObject;
import gameEngine.GameObjectAction;
import jgame.JGObject;
import jgame.JGPoint;
import jgame.platform.JGEngine;

//The invisible little object that moves around in the levels
public class LevelMover extends JGObject {
	//private Integer changeCounter;
	private static String moverImage = "srball";
	private static final double INITIAL_X_Y_SPEED = 2.0;
	private static final int BALL_COL_ID = 4;
	private static final int INITIAL_X_AND_Y = 20;
	private JGEngine myEngine;
	private LevelEditor myLevelEditor;
	private final static String RESOURCE_PATH = "/gameAuthoringEnvironment/levelEditor/Resources/";

	/**
	 * The object that moves around in the levels so user can edit them
	 * 
	 * @param levelEditor
	 *            LevelEditor that this object exists in
	 */
	public LevelMover(LevelEditor levelEditor) {

		super("srball", true, INITIAL_X_AND_Y, INITIAL_X_AND_Y, BALL_COL_ID,
				moverImage, 0, 0, INITIAL_X_Y_SPEED, INITIAL_X_Y_SPEED, -1);
		myEngine = levelEditor;
		myLevelEditor = levelEditor;
		x = INITIAL_X_AND_Y;
		y = INITIAL_X_AND_Y;
		activate();
	}

	private boolean checkKey(int key) {
		Boolean b = myEngine.getKey(key);
		myEngine.clearLastKey();
		return b;
	}

	public void move() {
		xdir = 0;
		ydir = 0;
		if (checkKey(myEngine.KeyLeft)) {
			xdir = -16;
			myEngine.clearKey(myEngine.KeyLeft);
		}
		if (checkKey(myEngine.KeyRight)) {
			xdir = 16;
			myEngine.clearKey(myEngine.KeyRight);
		}
		if (checkKey(myEngine.KeyUp)) {
			ydir = -16;
			myEngine.clearKey(myEngine.KeyUp);
		}
		if (checkKey(myEngine.KeyDown)) {
			ydir = 16;
			myEngine.clearKey(myEngine.KeyDown);
		}
		if (checkKey(myEngine.KeyEnter)) {
			System.out.println("Adding " + getImageName() + " to screen");
			myEngine.clearKey(myEngine.KeyEnter);
			HashMap<Integer, String> levelInputMap = new HashMap<Integer, String>();
			levelInputMap.put(39,  "moveRight");
			levelInputMap.put(37, "moveLeft");
			levelInputMap.put(40, "moveDown");
			levelInputMap.put(38, "moveUp");
			GameObject newObject = new GameObject("player", new JGPoint((int)x, (int)y), 1, moverImage, new GameObjectAction(levelInputMap), false);
			myLevelEditor.getMyLevel().addObjects(newObject);
			newObject.activate();
		}
	}

	public void changeImage(String imageName) {
		moverImage = imageName;
		myLevelEditor.defineImage(imageName, "n", 0, RESOURCE_PATH + imageName,
				"-");
	}
}<commit_msg>fixed error<commit_after>package gameAuthoringEnvironment.levelEditor;

//TODO make this work...
import java.util.HashMap;

import gameEngine.GameObject;
import gameEngine.GameObjectAction;
import jgame.JGObject;
import jgame.JGPoint;
import jgame.platform.JGEngine;

//The invisible little object that moves around in the levels
public class LevelMover extends JGObject {
	//private Integer changeCounter;
	private static String moverImage = "srball";
	private static final double INITIAL_X_Y_SPEED = 2.0;
	private static final int BALL_COL_ID = 4;
	private static final int INITIAL_X_AND_Y = 20;
	private JGEngine myEngine;
	private LevelEditor myLevelEditor;
	private final static String RESOURCE_PATH = "/gameAuthoringEnvironment/levelEditor/Resources/";

	/**
	 * The object that moves around in the levels so user can edit them
	 * 
	 * @param levelEditor
	 *            LevelEditor that this object exists in
	 */
	public LevelMover(LevelEditor levelEditor) {

		super("srball", true, INITIAL_X_AND_Y, INITIAL_X_AND_Y, BALL_COL_ID,
				moverImage, 0, 0, INITIAL_X_Y_SPEED, INITIAL_X_Y_SPEED, -1);
		myEngine = levelEditor;
		myLevelEditor = levelEditor;
		x = INITIAL_X_AND_Y;
		y = INITIAL_X_AND_Y;
		activate();
	}

	private boolean checkKey(int key) {
		Boolean b = myEngine.getKey(key);
		myEngine.clearLastKey();
		return b;
	}

	public void move() {
		xdir = 0;
		ydir = 0;
		if (checkKey(myEngine.KeyLeft)) {
			xdir = -16;
			myEngine.clearKey(myEngine.KeyLeft);
		}
		if (checkKey(myEngine.KeyRight)) {
			xdir = 16;
			myEngine.clearKey(myEngine.KeyRight);
		}
		if (checkKey(myEngine.KeyUp)) {
			ydir = -16;
			myEngine.clearKey(myEngine.KeyUp);
		}
		if (checkKey(myEngine.KeyDown)) {
			ydir = 16;
			myEngine.clearKey(myEngine.KeyDown);
		}
		if (checkKey(myEngine.KeyEnter)) {
			System.out.println("Adding " + getImageName() + " to screen");
			myEngine.clearKey(myEngine.KeyEnter);
			HashMap<Integer, String> levelInputMap = new HashMap<Integer, String>();
			levelInputMap.put(39,  "moveRight");
			levelInputMap.put(37, "moveLeft");
			levelInputMap.put(40, "moveDown");
			levelInputMap.put(38, "moveUp");
			GameObject newObject = new GameObject("player", new JGPoint((int)x, (int)y), 1, moverImage, levelInputMap, false);
			myLevelEditor.getMyLevel().addObjects(newObject);
			newObject.activate();
		}
	}

	public void changeImage(String imageName) {
		moverImage = imageName;
		myLevelEditor.defineImage(imageName, "n", 0, RESOURCE_PATH + imageName,
				"-");
	}
}
{'fraction_non_alphanumeric': 0.11394422310756971, 'fraction_numerical': 0.011155378486055778, 'mean_word_length': 4.451682953311618, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2010909', 'n_tokens_mistral': 1925, 'n_tokens_neox': 1729, 'n_words': 396}