added speed
checking if key is in keyCodes before adding
added min_x and min_y