There are no real collision methods with pure graphics. You could do some complicated stuff with GSPOIT, but the easiest way to bound something to the box is to simply limit the area the object can move in. E.g.: X and Y being the object's coordinates, and its home being its top-left corner and its size 16x16px, assuming box coordinates... X=MIN(10,MAX(399-16,X)) Y=MIN(10,MAX(239-16,Y))