The sample code you provided is not going to allow you to do collision detection or the like, because you're not holding references to multiple sprites--instead, you're replacing the same field. Let me give you an example that resembles your code, but simplifies the problem:
private int x;
private void setXRepeatedly(int count) {
for (int i = 0; i < count; i++) {
setX(MathUtils.random(10));
}
}
private void setX(int amount) {
x = amount;
}
If I ran this I would have no way of comparing one of the values of x with another value of x, because the older x value is constantly getting rewritten with no reference.
This is somewhat analogous to your code. Your createObstacle(int) method repeatedly calls your createObstacle(float, float) method, and the latter repeatedly sets the same obstacle field. So you're not holding a reference to multiple obstacles, you're only holding one.
Arrays
One solution would simply be to use multiple fields. In my example above, instead of having just an x variable, I could have a y, a z, and so forth. A better approach would be to use an array, and an even better approach would be to use a java collection. First Arrays:
In my example code above, instead of using int x, I could declare an array of ints, like this:
int[] myArray = new int[10];
This declares an array of ints and allocates memory for 10 of them. Now I could set individual ints in the array by putting the reference number in brackets. Like this:
myArray[8] = 5;
myArray[7] = 2;
etc.

So, in your example, we could have a declaration something like:
AnimatedSprite[] obstacles = new AnimatedSprite[10];
obstacles[0] = new AnimatedSprite(etc, etc.);
obstacles[1] = new AnimatedSprite(etc, etc.);
Note, arrays start counting at zero, not at one, and if you attempt to access or place data outside the bounds of what was allocated, you'll get an error. These and other reasons are why it often makes sense to use one of the java collections instead of an array.
ArrayList Example
There are a number of different java collections with different feaures and benefits for different situations. An ArrayList is a handy simple one that avoids the problem described above of having to know the total size in advance. You create an ArrayList like this:
ArrayList<AnimatedSprite> obstacles = new ArrayList<AnimatedSprite>();
Now I can add objects to the ArrayList using the add() method, like this:
obstacles.add(new AnimatedSprite(etc.,etc.));
You can also call methods like these:
- get( int index ) - retrieves object reference from ArrayList index position
- size() - returns ArrayList size
- remove( int index ) - removes the element at the specified position in this list. Shifts any subsequent elements to the left and returns the element that was removed from the list.
- indexOf( Object o) - finds the index in this list of the first occurrence of the specified element
- clear() - removes all of the elements