2d simple ai and spawning

How do I make an ai that goes from the x axis from 1-10 or something. I already can do the collisions as I have made “spike” scripts and “fall” scripts. I just want to figure out how to make the AI spawn at a certain rate, kinda like the goomba monsters that spawn out of the pipes in Mario (:D), and have it move on the x-axis from 1-10. Also, is there a way that when it collides with a vertical object called “ground”, it jumps, and continues moving, so that my AI don’t get stuck?

Use instantiate to create the object (from prefab) in a function use invokeRepeating to call that function repeatedly and vector3.movetowards to move to a point and back.
That’s the logic of it and what functions to use, hope it helps.

Links to documentation

http://docs.unity3d.com/ScriptReference/Object.Instantiate.html

http://docs.unity3d.com/ScriptReference/MonoBehaviour.InvokeRepeating.html

http://docs.unity3d.com/ScriptReference/Vector3.MoveTowards.html