If the movement is a simple back and forth or a square then timer behaviour seems like a good idea - just do something like every X seconds set movement angle to movement angle+180 degrees and your obstacle moves back and forth. +90 degrees and it moves in a square pattern (or toy with conditions to make it rectangular).
If it's something more complex search for "finite state machine" here.