alterY = 0;
alterY = (dLoc.getY() + (my - movingData[2]) / 8) / (MapEditor.sectorHeight * 2 * (MapEditor.tileHeight / 8));
    	public void mouseDragged(MouseEvent e)    	{    		int mx = e.getX(), my = e.getY();            if (mx < 0 || my < 0 || mx > getWidth() || my > getHeight())                return;                        if ((movingData[0] > -1)             		&& ((mx - movingData[1] != 0) || (my - movingData[1] != 0)))            {            	boolean repaint = false;            	if (movingData[0] == 0)            	{            		EbMap.SpriteLocation spLoc = EbMap.getSpriteLocation(            				movingData[3], movingData[4], movingData[5]);            		int alterX = 0, alterY = 0;            		short newSpX = spLoc.getX(), newSpY = spLoc.getY();        			        			if (spLoc.getX() + (mx - movingData[1]) >         					MapEditor.sectorWidth * MapEditor.tileWidth)        			{        				alterX = (spLoc.getX() + (mx - movingData[1]))							/ (MapEditor.sectorWidth * MapEditor.tileWidth);        				newSpX = 0;        			}        			else if (spLoc.getX() + (mx - movingData[1]) < 0)        			{        				alterX = (spLoc.getX() + (mx - movingData[1]))							/ (MapEditor.sectorWidth * MapEditor.tileWidth) - 1;        				newSpX = (short) (MapEditor.sectorWidth * MapEditor.tileWidth);        			}        			else        			{        				newSpX = (short) (spLoc.getX() + (mx - movingData[1]));        			}        			movingData[1] = mx;        			        			if (spLoc.getY() + my - movingData[2] >         					MapEditor.sectorHeight * 2 * MapEditor.tileHeight)        			{        				alterY = (spLoc.getY() + (my - movingData[2]))							/ (MapEditor.sectorHeight * 2 * MapEditor.tileHeight);        				newSpY = 0;        			}        			else if (spLoc.getY() + my - movingData[2] < 0)        			{        				alterY = (spLoc.getY() + (my - movingData[2]))							/ (MapEditor.sectorHeight * 2 * MapEditor.tileHeight) - 1;        				newSpY = (short) (MapEditor.sectorHeight * 2 * MapEditor.tileHeight);        			}        			else        			{        				newSpY = (short) (spLoc.getY() + (my - movingData[2]));        			}        			movingData[2] = my;        			        			    				int areaX = movingData[3], areaY = movingData[4];    				areaX += alterX;    				areaY += alterY;    				if ((areaX >= 0) && (areaY >= 0))    				{    					spLoc.setX(newSpX);    					spLoc.setY(newSpY);    					EbMap.removeSprite(movingData[3], movingData[4], movingData[5]);        				movingData[5] = EbMap.addSprite(areaX, areaY, spLoc);        				movingData[3] = areaX;        				movingData[4] = areaY;    				}        			        			repaint = true;            	}            	else if ((movingData[0] == 1)             			&& (((mx - movingData[1]) % 8 == 0) || (my - movingData[2]) % 8 == 0))            	{            		EbMap.DoorLocation dLoc =             			EbMap.getDoorLocation(movingData[3],movingData[4],movingData[5]);            		int alterX = 0, alterY = 0;            		short newDoorX = dLoc.getX(), newDoorY = dLoc.getY();            		if ((mx - movingData[1] != 0) && ((mx - movingData[1]) % 8 == 0))            		{            			if (dLoc.getX() + (mx - movingData[1]) / 8 >            					MapEditor.sectorWidth * (MapEditor.tileWidth / 8))            			{            				alterX = (dLoc.getX() + (mx - movingData[1]) / 8)								/ (MapEditor.sectorWidth * (MapEditor.tileWidth / 8));            				newDoorX = 0;            			}            			else if (dLoc.getX() + (mx - movingData[1]) / 8 < 0)            			{            				alterX = (dLoc.getX() + (mx - movingData[1]) / 8)								/ (MapEditor.sectorWidth * (MapEditor.tileWidth / 8)) - 1;            				newDoorX = (short) (MapEditor.sectorWidth * (MapEditor.tileWidth / 8));            			}            			else            				newDoorX = (short) (dLoc.getX() + (mx - movingData[1]) / 8);            			repaint = true;            			movingData[1] = mx;            		}            		            		if ((my - movingData[2] != 0) && ((my - movingData[2]) % 8 == 0))            		{            			if (dLoc.getY() + (my - movingData[2]) / 8 >            					MapEditor.sectorHeight * 2 * (MapEditor.tileHeight / 8))            			{            				alterY = 0;            				newDoorY = (short) (MapEditor.sectorHeight * 2 * (MapEditor.tileHeight / 8)            						- dLoc.getY());            			}            			else if (dLoc.getX() + (mx - movingData[1]) / 8 < 0)            			{            				alterY = (dLoc.getY() + (my - movingData[2]) / 8)								/ (MapEditor.sectorHeight * 2 * (MapEditor.tileHeight / 8)) - 1;            				newDoorY = (short) (MapEditor.sectorHeight * 2 * (MapEditor.tileHeight / 8));            			}            			else            				newDoorY = (short) (dLoc.getY() + (my - movingData[2]) / 8);            			repaint = true;            			movingData[2] = my;            		}            		    				int areaX = movingData[3], areaY = movingData[4];    				areaX += alterX;    				areaY += alterY;    				if ((areaX >= 0) && (areaY >= 0))    				{    					dLoc.setX(newDoorX);    					dLoc.setY(newDoorY);        				EbMap.removeDoor(movingData[3], movingData[4], movingData[5]);        				movingData[5] = EbMap.addDoor(areaX, areaY, dLoc);        				movingData[3] = areaX;        				movingData[4] = areaY;    				}            	}            	else if ((movingData[0] == 2)             			&& (((mx - movingData[1]) % 8 == 0) || (my - movingData[2]) % 8 == 0))            	{					HotspotEditor.Hotspot spot = HotspotEditor.getHotspot(movingData[3]);					if ((mx - movingData[1]) % 8 == 0)					{						spot.setX1((short) (spot.getX1() + (mx - movingData[1]) / 8));						spot.setX2((short) (spot.getX2() + (mx - movingData[1]) / 8));						movingData[1] = mx;					}										if ((my - movingData[2]) % 8 == 0)					{						spot.setY1((short) (spot.getY1() + (my - movingData[2]) / 8));						spot.setY2((short) (spot.getY2() + (my - movingData[2]) / 8));						movingData[2] = my;					}					repaint = true;            	}            	else if ((movingData[0] == 3)            			&& (((mx - movingData[1]) % 8 == 0) || (my - movingData[2]) % 8 == 0))            	{            		HotspotEditor.Hotspot spot = HotspotEditor.getHotspot(movingData[3]);					if ((mx - movingData[1]) % 8 == 0)					{						spot.setX2((short) (spot.getX2() + (mx - movingData[1]) / 8));						movingData[1] = mx;					}										if ((my - movingData[2]) % 8 == 0)					{						spot.setY2((short) (spot.getY2() + (my - movingData[2]) / 8));						movingData[2] = my;					}					repaint = true;            	}            	            	if (repaint)    				repaint();            }    	}