Make a condition for movement where if move == true then move. Change the flag to false when collision is true, here is an example: EED3K39J